Esempio n. 1
0
    public void DoMove(MoleEnemyController c, GameObject o)
    {
        // Look for player, can see only at specific distance
        // If player is not in vision, do nothing (Yeah, that's kind of stupid behavior, but time is running low)
        float distance = Mathf.Abs(o.transform.position.x - c.gameObject.transform.position.x);

        if (distance > c.seePlayerDistance)
        {
            return; // Do nothing XD (He's so stupid)
        }

        // Move toward player
        EnemyMovements.MoveTowardPlayer(c, o, c.walkspeed);

        if (c.IsAtChargeRange() == 0)
        {
            //If reached chargerange
            c.SetState(MoleStateFactory.creaChargePlayer());
        }
        else if (c.IsAtMeleeRange())
        {
            // If is not at chargerange but at meleerange
            c.SetState(MoleStateFactory.creaMeleeAttack());
        }
    }
Esempio n. 2
0
 // ------------------------------------------------------------------------
 // Override functions - StateBehavior
 // ------------------------------------------------------------------------
 public void DoAttack(MoleEnemyController c, GameObject o)
 {
     // Is is charging and reached the melee range, give a freaking motherf*****g big hit in your face
     if (c.IsAtMeleeRange() && c.isCharging)
     {
         //Debug.Log("[CHARGE]: charge just reached it's destination: poor player...");
         c.attack(); // Take that ugly player!
         c.SetState(MoleStateFactory.creaMeleeAttack());
     }
     // Else, is in range but must load it's charge (Move do the job)
 }
Esempio n. 3
0
 public void StopBlocking()
 {
     // Same remarks as "StopRunningAway" -> this is a design issue
     this.SetState(MoleStateFactory.creaMeleeAttack());
 }