Exemplo n.º 1
0
    private void Awake()
    {
        controller = GetComponent <PlayerPlatformer>();

        m_animator  = GetComponent <Animator>();
        m_rigidbody = GetComponent <Rigidbody2D>();
    }
Exemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.transform.CompareTag("Player"))
     {
         PlayerPlatformer player = collision.transform.GetComponent <PlayerPlatformer>();
         if (player)
         {
             bounceSFX.Play();
             player.SetBounceJump(1.6f);
             if (!super)
             {
                 OnBounceEvent.Invoke();
             }
         }
     }
     else if (collision.transform.CompareTag("Enemy"))
     {
         PlatformerCreature enemy = collision.transform.GetComponent <PlatformerCreature>();
         if (enemy)
         {
             bounceSFX.Play();
             if (collision.transform.position.y > transform.position.y + .1f)
             {
                 OnBounceEvent.Invoke();
                 enemy.OnBouncyTopEvent(transform.position, super);
             }
             else
             {
                 OnBounceEvent.Invoke();
                 enemy.OnBouncySideEvent(transform.position);
             }
         }
     }
 }
Exemplo n.º 3
0
 public virtual void OnTouchEvent(PlayerPlatformer player)
 {
     if (gameObject.activeSelf)
     {
         StartCoroutine(InteractionDelay(3));
     }
 }
Exemplo n.º 4
0
 private void Awake()
 {
     instance      = this;
     playerBase    = gameObject.GetComponent <Player_Base>();
     rigidbody2d   = transform.GetComponent <Rigidbody2D>();
     boxCollider2d = transform.GetComponent <BoxCollider2D>();
     isDead        = false;
 }
Exemplo n.º 5
0
    private void Awake()
    {
        shieldDirection = Directions.E;

        playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerPlatformer>();

        canCompute = true;
    }
Exemplo n.º 6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     playerscript = collision.GetComponent <PlayerPlatformer>();
     playerscript.DestroyChildren();
     playerscript.GetComponent <Rigidbody2D>().velocity  = Vector2.zero;
     playerscript.GetComponent <Rigidbody2D>().simulated = false;
     playerscript.gravityModifier = 0;
     playerscript.animator.SetTrigger("Fall");
 }
Exemplo n.º 7
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            playerScript.canHpUp = false;

            playerScript = null;
        }
    }
Exemplo n.º 8
0
    private void Awake()
    {
        controller = GetComponent <PlayerPlatformer>();

        m_animator  = GetComponent <Animator>();
        m_rigidbody = GetComponent <Rigidbody2D>();

        playerLayer   = LayerMask.NameToLayer("Player");
        platformLayer = LayerMask.NameToLayer("Platform");
    }
Exemplo n.º 9
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         PlayerPlatformer player = collision.GetComponent <PlayerPlatformer>();
         if (player)
         {
             player.SetJump(1.5f);
         }
     }
 }
Exemplo n.º 10
0
 public override void OnTouchEvent(PlayerPlatformer player)
 {
     base.OnTouchEvent(player);
     switch (state)
     {
     case State.Idle:
         player.SetDamage(transform.position, 1);
         if (attackCoroutine != null)
         {
             StopCoroutine(attackCoroutine);
         }
         attackCoroutine = StartCoroutine(AttackState());
         break;
     }
 }
Exemplo n.º 11
0
    public override void OnStompEvent(PlayerPlatformer player)
    {
        if (state == State.Stunned)
        {
            return;
        }

        base.OnStompEvent(player);

        player.SetEnemyJump();
        if (stunCoroutine != null)
        {
            StopCoroutine(stunCoroutine);
        }
        stunCoroutine
            = StartCoroutine(StunState(5 * new Vector2((!player.facingRight ? -1 : 1), .6f),
                                       (int)(stunTime * 60),
                                       player.facingRight));
    }
Exemplo n.º 12
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            PlayerPlatformer playerscript = collision.gameObject.GetComponent <PlayerPlatformer>();

            if (!playerscript.isBurning)
            {
                collision.gameObject.GetComponent <Rigidbody2D>().velocity = Vector2.up * rebound;
                playerscript.isBurning = true;
                playerscript.animator.SetBool("IsBurning", true);
                playerscript.StartCoroutine("ResetAddforce");
            }
            else
            {
                Destroy(collision.transform.GetChild(0).gameObject);
                collision.gameObject.GetComponent <Animator>().SetTrigger("FireDeath");
            }
        }
    }
Exemplo n.º 13
0
    public override void OnStompEvent(PlayerPlatformer player)
    {
        if (stunned)
        {
            return;
        }

        base.OnStompEvent(player);

        ResetValues();

        if (state == State.Dizzy)
        {
            StopAllCoroutines();
        }

        player.SetEnemyJump();

        state = State.Idle;
        ResetValues();
        StartCoroutine(StunState(5 * new Vector2((!player.facingRight ? -1 : 1), .6f),
                                 (int)(stunTime * 60),
                                 player.facingRight));
    }
Exemplo n.º 14
0
 public virtual void OnTouchEvent(PlayerPlatformer player)
 {
     player.SetDamage(transform.position, 1);
 }
Exemplo n.º 15
0
 public virtual void OnStompEvent(PlayerPlatformer player)
 {
     player.SetEnemyJump();
     Vanish();
 }
Exemplo n.º 16
0
    public override void OnTouchEvent(PlayerPlatformer player)
    {
        base.OnTouchEvent(player);

        player.SetDamage(transform.position, 1);
    }
Exemplo n.º 17
0
 private void Awake()
 {
     playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerPlatformer>();
 }
Exemplo n.º 18
0
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerPlatformer>();

        playerRb2d = player.GetComponent <Rigidbody2D>();
    }