示例#1
0
    //Start Coroutine on TriggerEnter
    void OnTriggerEnter2D(Collider2D player)
    {
        PNJBehaviour pnj = player.gameObject.GetComponent <PNJBehaviour>();

        if (pnj != null && player.gameObject == GameController.Instance.player)
        {
            StartCoroutine("NextLevel");
        }
    }
示例#2
0
    public void shootSpirit()
    {
        playSound();
        PNJBehaviour pnj = gameObject.GetComponent <PNJBehaviour>();

        pnj.isPlayer = false;
        GameObject mindProjectile = Instantiate(projectileSprite);

        mindProjectile.GetComponent <SpiritBehaviiour>().oldBody = gameObject;
        playerToAI(mindProjectile, gameObject);
        Vector2 projectileDirection = (Quaternion.Euler(new Vector3(0, 0, directionAngle)) * Vector2.left).normalized;

        Physics2D.IgnoreCollision(GetComponent <Collider2D>(), mindProjectile.GetComponent <Collider2D>());
        mindProjectile.transform.position = transform.position;
        mindProjectile.transform.Rotate(new Vector3(0, 0, directionAngle));
        mindProjectile.GetComponent <Rigidbody2D>().AddForce(projectileDirection * 500 * GameController.Instance.soulSpeed);
        mindProjectile.GetComponent <SpiritBehaviiour>().direction = projectileDirection;
        anim.SetBool("isMoving", false);
    }
示例#3
0
 // Use this for initialization
 void Start()
 {
     base.Start();
     projectileSprite = GameController.Instance.spiritProjectile;
     pnj = GetComponent <PNJBehaviour>();
     if (gameObject.CompareTag("CAC"))
     {
         anim.runtimeAnimatorController = Resources.Load("possMeleeAnimator") as RuntimeAnimatorController;
     }
     else if (gameObject.CompareTag("RANGE"))
     {
         anim.runtimeAnimatorController = Resources.Load("PossGunner") as RuntimeAnimatorController;
     }
     else if (gameObject.CompareTag("SUPER_RANGE"))
     {
         anim.runtimeAnimatorController = Resources.Load("MeleeHumanNormal") as RuntimeAnimatorController;
     }
     else
     {
         anim.runtimeAnimatorController = Resources.Load("basicPosses") as RuntimeAnimatorController;
     }
 }
示例#4
0
    private bool spiritToAI(GameObject newBody)
    {
        PNJBehaviour pnj      = newBody.GetComponent <PNJBehaviour>();
        bool         isSpirit = pnj != null;

        if (pnj != null)
        {
            Destroy(this.gameObject);
            Destroy(pnj.controller);
            PlayerController player = newBody.AddComponent <PlayerController>() as PlayerController;
            pnj.controller = player;
            if (newBody != oldBody)
            {
                GameController.Instance.changeBody(newBody);
            }
            else
            {
                GameController.Instance.player = newBody;
            }
            pnj.isPlayer = true;
        }
        return(isSpirit);
    }