Esempio n. 1
0
        public void Commands(char[] commands)
        {
            foreach (var cmd in commands)
            {
                ICommand command;
                if (cmd.Equals('f'))
                {
                    command = new CommandForward(this);
                }

                if (cmd.Equals('b'))
                {
                    command = new CommandBackwards(this);
                }

                if (cmd.Equals('l'))
                {
                    command = new CommandLeft(this);
                }

                if (cmd.Equals('r'))
                {
                    command = new CommandRight(this);
                }

                command.Execute();
            }
        }
Esempio n. 2
0
    void Start()
    {
        command = new CommandManager();
        command.SetCommand("Left", KeyCode.LeftArrow);
        command.SetCommand("Right", KeyCode.RightArrow);
        command.SetCommand("Jump", KeyCode.Z);
        command.SetCommand("Attack", KeyCode.X);

        Debug.Log("조작키 Left :" + command.GetCommand("Left"));

        cmd_Left     = new CommandLeft();
        cmd_Right    = new CommandRight();
        cmd_Jump     = new CommandJump();
        cmd_JumpHold = new CommandJumpHold();
        cmd_Attack   = new CommandAttack();

        bulletFactory.Init();

        faceDir = 1;
    }
Esempio n. 3
0
 protected virtual void OnCommandRight(CommandEventArgs e)
 {
     CommandRight?.Invoke(this, e);
 }