private void Start() { _camp = GameObject.Find("InitializeController").GetComponent <Initialize>().Camp; GameBody.GetComponent <SpriteRenderer>().color = _camp; Interact.GetComponent <InteractController>().InteractAreaColor = _camp; Interact.GetComponent <InteractController>().InteractCollider.GetComponent <ColliderController>().Camp = _camp; BodyCollider.GetComponent <ColliderController>().Camp = _camp; StateBar statebar = Info.GetComponent <StateBar>(); _health = PlayerConfig._TotalHealth; _energy = PlayerConfig._TotalEnergy; statebar.TotalHealth = _health; statebar.TotalEnergy = _energy; statebar.CurrentEnergy = _energy; statebar.CurrentHealth = _health; GameObject.Find("Collector").GetComponent <Collector>().Player = gameObject; Vector3 CP = new Vector3(); CP = transform.position; CP.z = -10; Camera.main.transform.position = CP; WS = GameObject.Find("WebSocketController").GetComponent <WebSocketController>(); PP = new MessageBox.PlayerPosition(); MB = new MessageBox.MessageBase(); }
public static StateBar Instance() { if (_instance == null) { _instance = new StateBar(); } return(_instance); }
public override void Execute(Miner t) { if (t.ThrstyToBar()) { t.GetStateMachine().ChangeState(StateBar.Instance()); } if (t.TiredtoHome()) { t.GetStateMachine().ChangeState(StateHome.Instance()); } }
private void Start() { _camp = GameObject.Find("InitializeController").GetComponent <Initialize>().Camp; GameBody.GetComponent <SpriteRenderer>().color = _camp; Interact.GetComponent <InteractController>().InteractAreaColor = _camp; Interact.GetComponent <InteractController>().InteractCollider.GetComponent <ColliderController>().Camp = _camp; BodyCollider.GetComponent <ColliderController>().Camp = _camp; StateBar statebar = Info.GetComponent <StateBar>(); _health = HingeConfig._TotalHealth; _energy = HingeConfig._TotalEnergy; statebar.TotalHealth = _health; statebar.TotalEnergy = _energy; statebar.CurrentEnergy = _energy; statebar.CurrentHealth = _health; }
public void Init(Color camp) { gameObject.GetComponentInChildren<StateBar>().id = id; Camp = camp; gameObject.GetComponent<SpriteRenderer>().color = Camp; gameObject.GetComponent<ColliderController>().Camp = Camp; StateBar statebar = Info.GetComponent<StateBar>(); switch (type) { case Type.Player: float _health = PlayerConfig._TotalHealth; float _energy = PlayerConfig._TotalEnergy; statebar.TotalHealth = _health; statebar.TotalEnergy = _energy; statebar.CurrentEnergy = _energy; statebar.CurrentHealth = _health; break; case Type.Hinge: _health = HingeConfig._TotalHealth; _energy = HingeConfig._TotalEnergy; statebar.TotalHealth = _health; statebar.TotalEnergy = _energy; statebar.CurrentEnergy = _energy; statebar.CurrentHealth = _health; break; case Type.Field: _health = Field._TotalHealth; _energy = Field._TotalEnergy; statebar.TotalHealth = _health; statebar.TotalEnergy = _energy; statebar.CurrentEnergy = 0; statebar.CurrentHealth = 0; gameObject.GetComponent<SpriteRenderer>().color = CampDefine.Campless; gameObject.GetComponentInChildren<OtherBuildingBar>().Fill.color = Camp; gameObject.GetComponentInChildren<OtherBuildingBar>().TotalHealth = _health; gameObject.GetComponentInChildren<OtherBuildingBar>().BuildTime = Field._BuildingTime; break; } Collector.KeyValuePair Pair = new Collector.KeyValuePair { key = id, value = gameObject }; Collector.Others.Add(Pair); }
//вызывается один раз при старте. void Start() { enemyCameraTr = GameObject.Find("CameraMinimap").transform; //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& prefEndExpl = Resources.Load("exp_big") as GameObject; //Загружаем префаб из ресурсов. Можно было бы и в редакторе драг энд дропо перенести. prefHitExpl = Resources.Load("Explosion") as GameObject; curHealth = maxHealth; curShield = maxShield; audio = GetComponent <AudioSource>(); if (isPlayer)//получаем скрипт строки состояния корабля { stateBar = GameObject.Find("PlayerBar").GetComponent <StateBar>(); } else { stateBar = GameObject.Find("EnemyBar").GetComponent <StateBar>(); } }
private void Start() { _camp = GameObject.Find("InitializeController").GetComponent <Initialize>().Camp; GameBody.GetComponent <SpriteRenderer>().color = CampDefine.Campless; Interact.GetComponent <InteractController>().InteractCollider.GetComponent <ColliderController>().Camp = _camp; BodyCollider.GetComponent <ColliderController>().Camp = _camp; StateBar statebar = Info.GetComponent <StateBar>(); _health = TurretConfig._TotalHealth; _energy = TurretConfig._TotalEnergy; statebar.TotalHealth = _health; statebar.TotalEnergy = _energy; statebar.CurrentEnergy = 0; statebar.CurrentHealth = 0; isBuilding = true; BuildingBar.GetComponent <BuildingBarController>().TotalHealth = _health; BuildingBar.GetComponent <BuildingBarController>().BuildTime = TurretConfig._BuildingTime; GameObject.Find("Collector").GetComponent <Collector>().Turret.Add(gameObject); }
private StateBar(StateBar state) { }