Exemplo n.º 1
0
    public void RecieveEvent(CustomEvent evt)
    {
        if(evt.GetEventName() == "Sword Attack")
        {
            int evtX, evtY, x, y;
            evtX = evt.GetParam(0);
            evtY = evt.GetParam(1);
            x = (int)transform.position.x;
            y = (int)transform.position.y;

            float distance = Vector3.Distance(transform.position, new Vector3(evtX, evtY, 0.0f));

            if(distance < 120.0f)
            {
                this.takeDamage(1, evt.GetParam(2));
            }
        }
    }
Exemplo n.º 2
0
    void RecieveEvent(CustomEvent evt)
    {
        if(evt.GetEventName() == "Sword Attack")
        {
            int evtX, evtY;
            evtX = evt.GetParam(0);
            evtY = evt.GetParam(1);

            float distance = Vector3.Distance(transform.position, new Vector3(evtX, evtY, 0.0f));

            if(distance < 40.0f)
            {
                this.takeDamage((int)ATTACK_TYPE.MELEE, evt.GetParam(2));
            }
        }
    }