public void setState(CampState state) { /* * States: * Environment Core should call to set the TURRET State * CampTurret should call to set the CHEST State * CampChest should call to set the EMPTY State * * Camp needs to first be fully integrated into the environment, look at the existing code and I will help you with this. * We will use a prefab for the chest and turret, with stubbed and incomplete code. I will be fleshing out Camp Turret to have ready for you tomorrow. * You will need to add both to the DefaultTiles and Map object. Spawn them as children to the Tile Holder and Tag them as shown in MapSlice. * -Craig * */ this.campState = state; switch (state) { case CampState.TURRET: turret.GetComponent <CampTurret>().stats.health = 10 * tile.value; turret.GetComponent <CampTurret>().reset(); turret.SetActive(true); chest.SetActive(false); isEmpty = false; if (debugMode) { Debug.Log("Turret made"); } respawnPoint = false; break; case CampState.CHEST: turret.SetActive(false); chest.SetActive(true); chest.GetComponent <Powerup>().init(tile.overlord, tile.value); chest.GetComponent <Powerup>().loadItem(tile.value); //may not be tile.value isEmpty = false; if (debugMode) { Debug.Log("Chest made"); } respawnPoint = false; break; case CampState.EMPTY: turret.SetActive(false); chest.SetActive(false); isEmpty = true; if (debugMode) { Debug.Log("Empty Camp made"); } respawnPoint = true; //set off some sort of respawn timer break; } }
public void Spawn() { Sprite.Reset(); Sprite.Show(); RenderText.text = ""; State = CampState.Alive; RespawnTime = 0; }
public virtual void InitData(PlayerBase owner, DirectType direct) { if (owner == null) { Debug.LogError("源头是空的!"); return; } OwnerPlayer = owner; directValue = direct; camp = OwnerPlayer.CurCamp; }
public void Kill(float respawn) { if (respawn == 0.0f) //Camp found dead. { Sprite.GrayScale(); Sprite.Show(); } else { Sprite.Hide(); } State = respawn == 0.0f ? CampState.Unknown : CampState.Dead; RespawnTime = Environment.TickCount + _respawnDuration + 1000 + Game.Ping; }