Having an Error with An Enum : error CS0176: Static member `BossOne.BossActionType.Attacking' cannot be accessed with an instance reference, qualify it with a type name instead

new to enum states, trying to get it to chage state when a player gets in range…

error CS0176: Static member `BossOne.BossActionType.Attacking’ cannot be accessed with an instance reference, qualify it with a type name instead

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BossOne : MonoBehaviour {	
public enum BossActionType
	{
		Aleted,
		Dorment,
		Attacking
	}

	public BossActionType BossStance;


// Update is called once per frame
	void Update () {
		switch (BossStance)
		{
		case BossActionType.Dorment:
			break;

		case BossActionType.Aleted:
			break;

		case BossActionType.Attacking:
			break;



		}
	}



void OnTriggerEnter (Collider other){
		if (other.gameObject.tag == "Player") {
			BossActionType BossStances = BossStance.Aleted;

		}
	}


	void OnTriggerExit (Collider other){
		if (other.gameObject.tag == "Player") {
			BossActionType BossStances  =	BossStance.Dorment;

		}
	}

Skip to third point for Solution. The rest explains other problems you are going to encounter.

Within C# you can have more than one variable with the same name, if the new variable is nested within a loop or a function. So the problem is with these lines:

void OnTriggerEnter (Collider other){
         if (other.gameObject.tag == "Player") {
             BossActionType BossStances = BossStance.Aleted;
 
      }
}
 
 
void OnTriggerExit (Collider other){
       if (other.gameObject.tag == "Player") {
             BossActionType BossStances  =    BossStance.Dorment;
 
         }
}

Each time a check is done you create a new variable called BossStances . And as soon as you leave the If function that checks for the tag that variable is lost. So simply write:

void OnTriggerEnter (Collider other){
         if (other.gameObject.tag == "Player") {
             BossStance = BossStance.Aleted;
 
      }
}     
 
void OnTriggerExit (Collider other){
       if (other.gameObject.tag == "Player") {
             BossStance  =    BossStance.Dorment;
 
         }
}

Secondly not sure why you are creating a new variable BossStance( s ). These variables just get destroyed and never used again with each check.

Lastly, you never assign an Stance to your BossStance variable, so add the following:

void Start () {
    BossStance = BossActionType.Dorment;
}

Hi, thanks for the Input. Missed the START function to set the start Stance of the Boss, I have Already tried BossStance = BossStance.Attacking;
that was the first thing I tried and I got

error CS0176: Static member `BossOne.BossActionType.Attacking’ cannot be accessed with an instance reference, qualify it with a type name instead

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BossOne : MonoBehaviour {

	public GameObject UfoGun1;
	public GameObject UfoGun2;
	public GameObject UfoGun3;

	public GameObject gunStartPos;

	public GameObject gunAttackPos1;
	public GameObject gunAttackPos2;
	public GameObject gunAttackPos3;

	public Material GunClosed;
	public Material GunOpen;

	public Material GunToChange1;
	public Material GunToChange2;
	public Material GunToChange3;


	public bool WeekpointActive;

	public enum BossActionType
	{
		Aleted,
		Dorment,
		Attacking
	}

	public BossActionType BossStance;



	// Use this for initialization
	void Start () {
		GunToChange1 = GunClosed;
		GunToChange2 = GunClosed;
		GunToChange3 = GunClosed;
		BossStance = BossActionType.Dorment;
	}
	
	// Update is called once per frame
	void Update () {
		switch (BossStance)
		{
		case BossActionType.Dorment:
			HandleDormentState ();
			break;

		case BossActionType.Aleted:
			HandleAletedState ();
			break;

		case BossActionType.Attacking:
			HandleAttackingState ();
			break;



		}
	}


	void HandleDormentState(){
		UfoGun1.transform.position = gunStartPos.transform.position; // LERP
		UfoGun2.transform.position = gunStartPos.transform.position; // LERP
		UfoGun3.transform.position = gunStartPos.transform.position;
	}

	void HandleAletedState(){
		UfoGun1.transform.position = gunAttackPos1.transform.position; // LERP
		UfoGun2.transform.position = gunAttackPos2.transform.position; // LERP
		UfoGun3.transform.position = gunAttackPos3.transform.position; // LERP
		StartCoroutine(WaitforAttack());

	}

	void HandleAttackingState() {
		StartCoroutine(AttackGun1());
	}

	IEnumerator WaitforAttack (){
		yield return new WaitForSeconds (3.0f);
		BossStance = BossStance.Attacking;
	}

	IEnumerator AttackGun1(){
		GunToChange1  = GunOpen;
		WeekpointActive = true;
		yield return new WaitForSeconds (3.0f);

		GunToChange1  = GunClosed;
		WeekpointActive = false;
		yield return new WaitForSeconds (1.0f);
		StartCoroutine(AttackGun2());

	}

	IEnumerator AttackGun2(){
		GunToChange2  = GunOpen;
		WeekpointActive = true;
		yield return new WaitForSeconds (3.0f);

		GunToChange2  = GunClosed;
		WeekpointActive = false;
		yield return new WaitForSeconds (1.0f);
		StartCoroutine(AttackGun3());

	}

	IEnumerator AttackGun3(){
		GunToChange3  = GunOpen;
		WeekpointActive = true;
		yield return new WaitForSeconds (3.0f);

		GunToChange3  = GunClosed;
		WeekpointActive = false;
		yield return new WaitForSeconds (1.0f);
		StartCoroutine(AttackGun1());

	}
		




	void OnTriggerEnter (Collider other){
		if (other.gameObject.tag == "Player") {
			BossStance = BossStance.Aleted;

		}
	}


	void OnTriggerExit (Collider other){
		if (other.gameObject.tag == "Player") {
			BossStance  =	BossStance.Dorment;

		}
	}



}