public static Action <Entity> EntityAction(int actionID)
    {
        switch (actionID)
        {
        case 0:
            return(new Action <Entity>((target) =>
            {
                if (Vector3.Distance(EntityHandler.GetEntity <NPC>(0).transform.position, target.transform.position) <= 3f)
                {
                    ActionPacket packet = (ActionPacket)actionHandler.GetComponent(typeof(OpenChat));

                    if ((target as Player).questStateLib[0] <= 0)
                    {
                        GetPacket(typeof(OpenChat)).Invoke(target.id, 0);
                    }
                    else if ((target as Player).questStateLib[0] == 1)
                    {
                        GetPacket(typeof(OpenChat)).Invoke(target.id, 1);
                    }
                }
                else
                {
                    EntityHandler.DestroyEntity <Player>(target);
                }
            }));

        default:
            return(null);
        }
    }
Example #2
0
 public void Destroy() => EntityHandler.DestroyEntity <Player>(this);