Exemple #1
0
        /// <summary>
        /// Raised when hitbox defensive collides with another.
        /// hitbox which entered this one.
        /// </summary>
        protected void HitboxDefensiveOnTriggerEntered(Hitbox source, Hitbox other)
        {
            Renderer renderer = source.GetComponentInParent <Renderer>();

            if (renderer)
            {
                renderer.material.color = Color.red;
            }
        }
Exemple #2
0
    void OnCollisionStay2D(Collision2D col)
    {
        Hitbox other = col.collider.GetComponent <Hitbox>();

        if (other != null && Active && !other.Active)
        {
            // TODO: Find a way to deactive the entire move?
            // This allows the same move to hit the opponent multiple times in different hitboxes
            Active = false;

            Character character = GetComponentInParent <Character>();
            Character target    = other.GetComponentInParent <Character>();
            eventManager.raiseEvent(new HitEvent(
                                        new HitEventArgs(
                                            character.CurrentMove,
                                            character,
                                            target),
                                        new EventSource(this)));
        }
    }