public override bool Equals(AbstractEntity other)
        {
            if (other == null)
            {
                return(false);
            }

            if (!ObjectContext.GetObjectType(GetType()).Equals(ObjectContext.GetObjectType(other.GetType())))
            {
                return(false);
            }

            QuadrupleKeyEntity <TKeyA, TKeyB, TKeyC, TKeyD> castedOther = (QuadrupleKeyEntity <TKeyA, TKeyB, TKeyC, TKeyD>)other;

            return(!castedOther.IsEmptyKey() &&
                   KeyA.Equals(castedOther.KeyA) &&
                   KeyB.Equals(castedOther.KeyB) &&
                   KeyC.Equals(castedOther.KeyC) &&
                   KeyD.Equals(castedOther.KeyD));
        }
    void HandleInput()
    {
        //TODO: Break into chunks of actions that can be performed at the same time, ie movmenet actions, attack actions, etc
        if (Input.GetKeyDown(KeyCode.W))
        {
            KeyW.Execute(Character, KeyW);
        }
        if (Input.GetKeyDown(KeyCode.A))
        {
            KeyA.Execute(Character, KeyA);
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            KeyS.Execute(Character, KeyS);
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            KeyD.Execute(Character, KeyD);
        }
        //TODO: Ensure the following cant be pressed at the same time as an action
        else if (Input.GetKeyDown(KeyCode.R))
        {
            KeyR.Execute(Character, KeyR);
        }
        else if (Input.GetKeyDown(KeyCode.Z))
        {
            KeyZ.Execute(Character, KeyZ);
        }
        else
        {
            //No keys pushed
            //new IdleCommand().Execute();
        }

        /*else if (Input.GetKeyDown(KeyCode.B))
         * {
         *      KeyB.Execute(KeyB);
         * }*/
    }
示例#3
0
 void HandleInput()
 {
     if (Input.GetKeyDown(KeyCode.W))
     {
         KeyW.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.S))
     {
         KeyS.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.A))
     {
         KeyA.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.D))
     {
         KeyD.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.Space))
     {
         snakehead.GetComponent <Snake>().CreateSnakePart();
         //Time.timeScale = 3;
     }
 }
 public override int GetHashCode()
 {
     return(IsEmptyKey() ? 0 : KeyA.GetHashCode() ^ KeyB.GetHashCode() ^ KeyC.GetHashCode() ^ KeyD.GetHashCode());
 }