Exemple #1
0
 // Use this for initialization
 public void OnEnable()
 {
     transform.position = FindObjectOfType <PlayerStateMachine>().transform.position + playerOffset;
     foreach (EnemyStateMachine enemy in enemies)
     {
         EnemyStateMachine clone = Instantiate(enemy);
         clone.transform.position = transform.position;
         clone.transform.Translate(new Vector3(Random.Range(-3, 3), Random.Range(-3, 3), 0));
         clone.GetComponent <Rigidbody2D>().AddForce((FindObjectOfType <PlayerStateMachine>().transform.position - clone.transform.position).normalized * 10);
     }
     Destroy(gameObject);
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (GetComponent <PointEffector2D>().enabled)
        {
            switch (type)
            {
            case PartnerType.SWORDMAN:
                partner.GetComponent <SwordmanStateMachine>().Jump();
                break;

            case PartnerType.ASPECT:
                partner.GetComponent <EndBossBehavior>().MinorJump();
                break;

            case PartnerType.EMPEROR:
                partner.GetComponent <EndBossBehavior>().MinorJump();
                break;

            case PartnerType.TRUE_EMPEROR:
                partner.GetComponent <EndBossBehavior>().MajorJump();
                break;
            }
        }
    }