Example #1
0
    public void CreateMissile(Vector3 position)
    {
        Missile missile = Missile.Instantiate(this.missilePrefab);

        missile.transform.position = position;
        MovesPlayer player = MovesPlayer.GetInstance();
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     this.distanceRun       = (int)Mathf.Floor(MovesPlayer.GetInstance().GetDistanceRun());
     this.coins             = (int)Mathf.Floor(MovesPlayer.GetInstance().GetCoins());
     this.distanceText.text = (distanceRun.ToString() + "M");
     this.coinsText.text    = (coins.ToString());
 }
Example #3
0
    public void CreateIndicator()
    {
        MissileIndicator indicator = MissileIndicator.Instantiate(this.missileInidicatorPrefab);
        MovesPlayer      player    = MovesPlayer.GetInstance();

        indicator.SetTarget(player.transform);
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        Vector3 position  = this.transform.position;
        float   halfWidth = GetWidth() / 2;

        position.x += halfWidth;
        if (this.hasBeenInsideCamera)
        {
            if (CameraController.GetInstance().BackgroundIsOver(position))
            {
                /*
                 * Destruir objeto
                 * GameObject.Destroy (this.gameObject);
                 */
                this.backgroundManager.OnOutOfCamera(this);

                if (cont % 6 == 0)
                {
                    MovesPlayer.GetInstance().IncreaseSpeed();
                }
                this.hasBeenInsideCamera = false;
                OnExitCameraBounds();
            }
        }
        else
        {
            position   = this.transform.position;
            position.x = (position.x - GetWidth() / 2);
            this.hasBeenInsideCamera = CameraController.GetInstance().IsInsideCamera(position);
            if (hasBeenInsideCamera)
            {
                OnEnterCameraBounds();
            }
        }
    }