Example #1
0
 // Use this for initialization
 void Start()
 {
     AudioSource.PlayClipAtPoint(Crash, Camera.main.transform.position);
     Manager        = FindObjectOfType <AIMoveDecision>();
     HighScore      = transform.Find("HighScoreHolder").transform.GetChild(0).GetComponent <Text>();
     HighScore.text = Manager.HighScore.ToString("F2");
 }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (WaypointManager == null)
     {
         WaypointManager = FindObjectOfType <AIMoveDecision>();
     }
     if (Blocked != true)
     {
         if (running == true)
         {
             Myposition = new Vector2(gameObject.transform.position.x, gameObject.transform.position.y);
             if (Myposition != MoveToPosition)
             {
                 if (isTank)
                 {
                     Debug.Log("Moving:" + MoveToPosition.ToString());
                 }
                 if (Time.timeScale == 1)
                 {
                     Mybody.AddForce((MoveToPosition - Myposition).normalized * MovementSpeed * Time.deltaTime);
                 }
                 else
                 {
                     Mybody.AddForce((MoveToPosition - Myposition).normalized * Time.deltaTime * 20 / MovementSpeed);
                 }
             }
         }
         else
         {
             StartCoroutine(RaycastAndMove());
         }
     }
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     WaypointManager = FindObjectOfType <AIMoveDecision>();
     running         = false;
     index0          = UnityEngine.Random.Range(0, WaypointManager.Waypoints.Count - 1);
     Left            = WaypointManager.Left.transform.position.x;
     Right           = WaypointManager.Right.transform.position.x;
     Mybody          = GetComponent <Rigidbody2D>();
     altWaypoint     = WaypointManager.Waypoints[index0];
     LookForward     = new Vector2(altWaypoint.transform.position.x, altWaypoint.transform.position.y + 0.2f);
     if (!isTank)
     {
         AIMoveDecision.BlockInitialised   += Move;
         AIMoveDecision.UnBlockInitialised += Return;
     }
     Blocked = false;
     Avoided = true;
 }
Example #4
0
 // Use this for initialization
 void Start()
 {
     Manager              = FindObjectOfType <AIMoveDecision>();
     PlaneManager         = FindObjectOfType <PlaneAIDecision>();
     Resume.enabled       = false;
     PlaneManager.enabled = false;
     Manager.enabled      = false;
     PlayerScript         = FindObjectOfType <PlayerMovement>();
     PlayerScript.enabled = false;
     Clampers             = GameObject.FindGameObjectWithTag("Container");
     Player       = PlayerScript.gameObject;
     PlayerDamage = Player.GetComponent <DamageSystrm>();
     BGMSource    = GetComponent <AudioSource>();
     BGMSource.Stop();
     Started = false;
     Clampers.SetActive(false);
     PlayerScript.Health.SetActive(false);
     TimeScore = gameObject.transform.Find("HighScore").transform.GetChild(0).GetComponent <Text>();
     DontDestroyOnLoad(TimeScore);
 }