Beispiel #1
0
    void Update()
    {
        spaceshipDir = transform.up;
        spaceshipDir.Normalize();

        if (takeInput)
        {
            HandleInput();
        }

        if (currHealth <= 0.0f)
        {
            Time.timeScale = 0.2f;
            takeInput      = false;
            gameOverPanel.SetActive(true);
        }

        if (interactor.returnedObject != null && interactor.returnedObject.tag == "Enemy")
        {
            target            = interactor.returnedObject.transform;
            aiTarget          = target.GetComponent <AISpaceship>();
            aiTarget.targeted = true;
        }

        //playerInfoTxt.text = string.Format( "Player Info\n-\nVelocity: {0}\nAngular Velocity: {1}\nSpaceship Facing Direction: {2}\n", ribo2D.velocity, ribo2D.angularVelocity, spaceshipDir );
        playerInfoTxt.text = string.Format("Integrity: {1}%\nShip Mutation: {0}", mutationName, currHealth / healthCapacity * 100.0f);
    }
Beispiel #2
0
 void Start()
 {
     if (transform.parent.tag == "Player")
     {
         player = transform.parent.GetComponent <Spaceship>();
         target = player.target;
     }
     else if (transform.parent.tag == "Enemy")
     {
         ai     = transform.parent.GetComponent <AISpaceship>();
         target = ai.target;
     }
 }
Beispiel #3
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Enemy" && origin == RelationshipOrigin.PLAYER)
     {
         AISpaceship ai = collider.GetComponent <AISpaceship>();
         ai.ApplyDamage(damage);
         Destroy(this.gameObject);
     }
     else if (collider.tag == "Player" && origin == RelationshipOrigin.ENEMY)
     {
         Spaceship player = collider.GetComponent <Spaceship>();
         player.ApplyDamage(damage);
         Destroy(this.gameObject);
     }
 }