Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class PlayerStatus : MonoBehaviour {
- private bool inHideZone;
- private bool isSneak;
- private bool isCrawl;
- private bool isRun;
- private bool isIdle;
- private bool isDie;
- public string EnemyTag;
- // Use this for initialization
- void Start () {
- notInHideZone ();
- }
- // Update is called once per frame
- void Update () {
- // Debug.Log ("Status Check, inHideZone: " + inHideZone + ", isSneak: " + isSneak +
- // ", isCrawl:" + isCrawl + ", isRun:" + isRun + ", isIdle:" + isIdle);
- }
- public void Taunt ()
- {
- bool guardCalled = false;
- GameObject[] enemies;
- enemies = GameObject.FindGameObjectsWithTag(EnemyTag);
- Debug.Log (enemies.Length);
- foreach (GameObject enemy in enemies)
- {
- if (enemy.GetComponent <EnermyAI> ().alertLevel == 1)
- {
- if ((transform.position.x >= enemy.transform.position.x &&
- transform.position.x <= enemy.transform.position.x + enemy.GetComponent <EnermyAI> ().alertLevelOneSeeDistance) ||
- (transform.position.x <= enemy.transform.position.x &&
- transform.position.x >= enemy.transform.position.x - enemy.GetComponent <EnermyAI> ().alertLevelOneSeeDistance))
- {
- guardCalled = true;
- Debug.Log ("Tell: " + enemy.gameObject.name);
- enemy.GetComponent <EnermyAI> ().HearPlayer (transform.position.x);
- }
- }
- // else if (enemy.GetComponent <EnermyAI> ().alertLevel == 3)
- // {
- // if ((transform.position.x >= enemy.transform.position.x &&
- // transform.position.x <= enemy.transform.position.x + enemy.GetComponent <EnermyAI> ().alertLevelThreeSeeDistance) ||
- // (transform.position.x <= enemy.transform.position.x &&
- // transform.position.x >= enemy.transform.position.x - enemy.GetComponent <EnermyAI> ().alertLevelThreeSeeDistance))
- // {
- //
- // }
- // }
- // else if (enemy.GetComponent <EnermyAI> ().alertLevel == 4)
- // {
- // if ((transform.position.x >= enemy.transform.position.x &&
- // transform.position.x <= enemy.transform.position.x + enemy.GetComponent <EnermyAI> ().alertLevelFourSeeDistance) ||
- // (transform.position.x <= enemy.transform.position.x &&
- // transform.position.x >= enemy.transform.position.x - enemy.GetComponent <EnermyAI> ().alertLevelFourSeeDistance))
- // {
- //
- // }
- // }
- // else if (enemy.GetComponent <EnermyAI> ().alertLevel == 5)
- // {
- // if ((transform.position.x >= enemy.transform.position.x &&
- // transform.position.x <= enemy.transform.position.x + enemy.GetComponent <EnermyAI> ().alertLevelFiveSeeDistance) ||
- // (transform.position.x <= enemy.transform.position.x &&
- // transform.position.x >= enemy.transform.position.x - enemy.GetComponent <EnermyAI> ().alertLevelFiveSeeDistance))
- // {
- //
- // }
- // }
- }
- if (!guardCalled)
- {
- Debug.Log ("in");
- GameObject enemyTmp = null;
- float distance = 999999f;
- foreach (GameObject enemy in enemies)
- {
- if (enemy.GetComponent <EnermyAI> ().alertLevel != 1 &&
- enemy.GetComponent <EnermyAI> ().alertLevel != 2 &&
- distance >= (Mathf.Abs(transform.position.x - enemy.transform.position.x)))
- {
- enemyTmp = enemy;
- distance = Mathf.Abs(transform.position.x - enemy.transform.position.x);
- }
- }
- if (distance != 999999f)
- {
- enemyTmp.GetComponent <EnermyAI> ().HearPlayer (transform.position.x);
- }
- }
- }
- public void isInHideZone ()
- {
- inHideZone = true;
- }
- public void notInHideZone ()
- {
- inHideZone = false;
- }
- public bool ifInHideZone ()
- {
- return inHideZone;
- }
- public void isSneaking ()
- {
- isSneak = true;
- }
- public void notSneaking ()
- {
- isSneak = false;
- }
- public void isCrawling ()
- {
- isCrawl = true;
- }
- public void notCrawling ()
- {
- isCrawl = false;
- }
- public void isRunning ()
- {
- isRun = true;
- }
- public void notRunning ()
- {
- isRun = false;
- }
- public void isIdling ()
- {
- isIdle = true;
- }
- public void notIdlling ()
- {
- isIdle = false;
- }
- public void isDead ()
- {
- isDie = true;
- }
- public void notDead ()
- {
- isDie = false;
- }
- public bool ifSneaking ()
- {
- return isSneak;
- }
- public bool ifCrawling ()
- {
- return isCrawl;
- }
- public bool ifRunning ()
- {
- return isRun;
- }
- public bool ifIdlling ()
- {
- return isIdle;
- }
- public bool ifDead ()
- {
- return isDie;
- }
- public void ReceiveDamage ()
- {
- Debug.Log ("ReceiveDamage!!!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement