예제 #1
0
    public bool Attack(ADLBaseAgent agent)
    {
        if (agent.IsEnvironment())
        {
            return(false);
        }

        if (this.isProjectile)
        {
            if (this.group != agent.group)
            {
                return(agent.DecreaseLifePoint(this));
            }
            return(false);
        }
        else
        {
            return(agent.DecreaseLifePoint(this));
        }
    }
예제 #2
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        //Debug.Log("Collision between " + this.gameObject.name + " " + coll.gameObject.name);

        ADLBaseAgent agent = coll.gameObject.GetComponent <ADLBaseAgent>();

        this.collisionList.Add(agent);

        this.Flip(agent);

        //Attack Event
        if (this.Attack(agent))
        {
            if (!agent.IsAlive())
            {
                if (agent is PlayerController && agent.gameObject.GetComponent <RockmanVisualAgent>() != null)
                {
                    // Do Nothing
                }
                else
                {
                    Destroy(agent.gameObject);
                }
            }
        }

        if (this.isProjectile && agent.IsEnvironment())
        {
            if (!this.isFlippable || !agent.isFlipper)
            {
                if (this.isHittableByEnvironment && !this.safeEnvironmentList.Contains(agent.agentName))
                {
                    Destroy(this.gameObject);
                }
            }
        }
    }