void ListWindow(int windowID) { scrollPosition = GUI.BeginScrollView(new Rect(20, 40, Screen.width/2 -30, Screen.height/4 + 150), scrollPosition, new Rect(0, 0, 400, sList.Count*30)); GUI.Label(new Rect(120, 0, 50, 20), "Ammo"); GUI.Label(new Rect(180, 0, 50, 20), "Hunger"); GUI.Label(new Rect(240, 0, 50, 20), "Defense"); GUI.Label(new Rect(300, 0, 50, 20), "Search"); for (int i = 1; i <= sList.Count; i++){ if(GUI.Button(new Rect(0, i*30, 100, 20), sList[i-1].name)){ theSurvivor = sList[i-1]; listWindowOn = false; infoWindowOn = true; } GUI.Label(new Rect(120, i*30, 50, 20), sList[i-1].ammo.ToString()); GUI.Label(new Rect(180, i*30, 50, 20), sList[i-1].hunger.ToString()); GUI.Label(new Rect(240, i*30, 50, 20), sList[i-1].skill.defence.ToString()); GUI.Label(new Rect(300, i*30, 50, 20), sList[i-1].skill.searchFood.ToString()); if(GUI.Button(new Rect(360, i*30, 100, 20), "doSearch")){ sList[i-1].State = new SearchAI(sList[i-1]); } if(GUI.Button(new Rect(480, i*30, 100, 20), "doDefense")){ sList[i-1].State = new Night(sList[i-1]); } } GUI.EndScrollView(); if(GUI.Button(new Rect(Screen.width/2 -130, Screen.height/4 + 200, 100,50 ), "Exit")) { listWindowOn = false; infoWindowOn = false; } if(GUI.Button(new Rect(Screen.width/4 - 300, Screen.height/4 + 200, 100,50 ), "Back")) { listWindowOn = listWindowOn? false: true; infoWindowOn = !listWindowOn; } }
public void doShoot(survivorAI enemy, zombie zombie) { //Debug.Log("doing AI shooting"); if(enemy != null) rotateToShoot(enemy.transform); else rotateToShoot(zombie.transform); float random = Random.Range (0.0f, 100.0f); if(random < skill.defence) { if(SwitchToNight()) { zombie.isDead = true; if(zombie.decayTime==0f) zombie.setDT(Time.time+1f); zombie.gameObject.tag = "Untagged"; zombie.gameObject.transform.renderer.material.color = Color.gray; doBulletEffect(zombie.gameObject.transform); } else { enemy.isDead = true; enemy.setDT(Time.time+1f); enemy.gameObject.tag = "Untagged"; enemy.gameObject.transform.renderer.material.color = Color.gray; doBulletEffect(enemy.gameObject.transform); } } ammo -= 1; lastShoot = Time.fixedTime; Debug.Log("Shooting!"); }
public FightState(survivorAI parent) : base(parent) { }
public StandByState(survivorAI parent) : base(parent) { }
public TalkState(survivorAI parent) : base(parent) { }
public SearchAI(survivorAI parent) : base(parent) { startSearch = Time.fixedTime; }
public DayState(survivorAI parent) : base(parent) { }
public RunState(survivorAI parent) : base(parent) { }
public Patrol(survivorAI parent) : base(parent) { }
public AbstractState(survivorAI survivor) { this.survivorAI = survivor; }
public Night(survivorAI parent) : base(parent) { }
public GoBaseAI(survivorAI surviror, AbstractState parent) : base(surviror) { this.Parent = parent; startSearch = Time.fixedTime; this.survivorAI.doSearch(20.0f, 13.0f); }