public void swapPlayer(ControlID cID)    //, int otherController)
    {
        //        int temp = a;
        //        a = b;
        //        b = temp;
        // Debug.Log(debugPlayerNum);
        AudioDriver.S.play(SoundType.swap);

        Debug.Log(cID);
        // NOTE: controllerThatFired will be a number from (1 - 3)
        Debug.Assert(cID != ControlID.None && cID != ControlID.Runner);

        // get the player currently controlling the runner
        PlayerInfo playerControllingRunnerInfo          = getPlayerInfoWithControlID(ControlID.Runner);
        PlayerInfo playerControllingCannonThatFiredInfo = getPlayerInfoWithControlID(cID);

        setPlayerInfoForControlID(cID, playerControllingRunnerInfo.playerID, playerControllingRunnerInfo.aiMode, playerControllingRunnerInfo.playerClr);

        // player who shot the cannon that hit the runner cannot be the player controlling the runner!
        Debug.Assert(playerControllingRunnerInfo.playerID != playerControllingCannonThatFiredInfo.playerID);

        // Get the player currently controlling the cannon that fired.

        setPlayerInfoForControlID(ControlID.Runner, playerControllingCannonThatFiredInfo.playerID,
                                  playerControllingCannonThatFiredInfo.aiMode, playerControllingCannonThatFiredInfo.playerClr);
//		if (debugPlayerNum == 4)
//			debugPlayerNum = cannonThatFired;
//		else
//			debugPlayerNum = 4;
        PowerUp.S.resetPowerUpStates();          // Remove all powerups.
    }
 public PlayerInfo(PlayerID pID, ControlID cID,
                   AIMode _aiMode, PlayerColor pClr)
 {
     playerID  = pID;
     controlID = cID;
     aiMode    = _aiMode;
     playerClr = pClr;
 }
    public void setPlayerInfoForControlID(ControlID cID, PlayerID pID, AIMode aiMode, PlayerColor pClr)
    {
//		if(playerControllerMappings.Where  (pcm => pcm.playerID == pID).ToList().Count == 0)
//			playerControllerMappings.Where (pcm => pcm.controlID == cID).First ().playerID = PlayerID.AI;
//		else
        PlayerInfo pInfo = playerInfoList.Where(pcm => pcm.controlID == cID).First();

        pInfo.playerID  = pID;
        pInfo.aiMode    = aiMode;
        pInfo.playerClr = pClr;
    }
 public PlayerColor getPlayerColorWithControlID(ControlID cID)
 {
     foreach (PlayerInfo pcm in playerInfoList)
     {
         if (pcm.controlID == cID)
         {
             return(pcm.playerClr);
         }
     }
     return(PlayerColor.None);
 }
示例#5
0
        public IControl GetControl(ControlID id)
        {
            switch (id)
            {
            case ControlID.Keyboard:
                return(k);

            case ControlID.Mouse:
                return(m);
            }
            return(null);
        }
    // get the JoyNum controlling a given cannon (1 - 3) or runner (4)
//	public int getPlayerJoyNumForController(int controller) {
//		if(player1JoyNum == controller)
//			return 1;
//		else if(player2JoyNum == controller)
//			return 2;
//		else if(player3JoyNum == controller)
//			return 3;
//		else
//			return 4;
//	}

    public PlayerInfo getPlayerInfoWithControlID(ControlID cID)
    {
        foreach (PlayerInfo pcm in playerInfoList)
        {
            if (pcm.controlID == cID)
            {
                return(new PlayerInfo(pcm.playerID, pcm.controlID, pcm.aiMode, pcm.playerClr));
            }
        }
        Debug.Log(cID);
        Debug.Assert(false);          // Controller does not exist! !!WARNING!!
        return(new PlayerInfo(PlayerID.None, ControlID.None, AIMode.None, PlayerColor.None));
    }
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var controlid = ControlID.Get(context);

            ///////////////////////////
            // Add execution logic HERE
            SAPAuto objSAPAuto      = new SAPAuto();
            String  strTextBoxValue = objSAPAuto.Get_TextBox_Value_ByID(controlid);

            ///////////////////////////

            // Outputs
            return((ctx) => {
                TextBoxValue.Set(ctx, strTextBoxValue);
            });
        }
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var controlid = ControlID.Get(context);

            ///////////////////////////
            // Add execution logic HERE
            SAPAuto objSAPAuto   = new SAPAuto();
            string  strLabelText = objSAPAuto.GetLabelText(controlid);

            ///////////////////////////

            // Outputs
            return((ctx) => {
                LabelText.Set(ctx, strLabelText);
            });
        }
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var controlid = ControlID.Get(context);
            var text      = Text.Get(context);

            ///////////////////////////
            // Add execution logic HERE
            SAPAuto objSAPAuto = new SAPAuto();

            objSAPAuto.TextInputByID(controlid, text);
            ///////////////////////////

            // Outputs
            return((ctx) => {
            });
        }
示例#10
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var controlid = ControlID.Get(context);
            var itemkey   = ItemKey.Get(context);

            ///////////////////////////
            // Add execution logic HERE
            SAPAuto objSAPAuto = new SAPAuto();

            objSAPAuto.TreeView_Select(controlid, itemkey);
            ///////////////////////////

            // Outputs
            return((ctx) => {
            });
        }
示例#11
0
    }//end update

    public void debugSwap(ControlID desiredCID)
    {
        ControlID currentCID = getPlayerInfoWithPlayerID(PlayerID.Debug).controlID;

        float f = Random.value;

        if (f <= 1.0f / 3.0f)
        {
            if (getPlayerInfoWithPlayerID(PlayerID.Player2).controlID == ControlID.None)
            {
                setPlayerInfoForControlID(currentCID, PlayerID.Player2, AIMode.On, ((PlayerColor)2));
            }
            else
            {
                setPlayerInfoForControlID(currentCID, PlayerID.Player2, AIMode.Off, ((PlayerColor)2));
            }
        }
        else if (f > 1.0 / 3.0f && f <= 2.0f / 3.0f)
        {
            if (getPlayerInfoWithPlayerID(PlayerID.Player3).controlID == ControlID.None)
            {
                setPlayerInfoForControlID(currentCID, PlayerID.Player3, AIMode.On, ((PlayerColor)3));
            }
            else
            {
                setPlayerInfoForControlID(currentCID, PlayerID.Player3, AIMode.Off, ((PlayerColor)3));
            }
        }
        else if (f > 2.0 / 3.0f && f <= 3.0f / 3.0f)
        {
            if (getPlayerInfoWithPlayerID(PlayerID.Player4).controlID == ControlID.None)
            {
                setPlayerInfoForControlID(currentCID, PlayerID.Player4, AIMode.On, ((PlayerColor)4));
            }
            else
            {
                setPlayerInfoForControlID(currentCID, PlayerID.Player4, AIMode.On, ((PlayerColor)4));
            }
        }

        setPlayerInfoForControlID(desiredCID, PlayerID.Player1, AIMode.Off, ((PlayerColor)1));
        PowerUp.S.resetPowerUpStates();          // Remove all powerups.
    }
示例#12
0
 public IControl GetControl(ControlID id)
 {
     switch (id)
     {
         case ControlID.Keyboard:
             return kb;
         case ControlID.Mouse:
             return m;
         default:
             return null;
     }
 }
示例#13
0
 public IControl GetControl(ControlID id)
 {
     return(null);
 }
示例#14
0
    private void randomizePlayers(int numOfPlayers)
    {
        List <ControlID> cIDList = new List <ControlID>()
        {
            ControlID.Cannon1,
            ControlID.Cannon2,
            ControlID.Cannon3,
            ControlID.Runner
        };

        List <PlayerID> pIDList = new List <PlayerID>()
        {
            PlayerID.Player1,
            PlayerID.Player2,
            PlayerID.Player3,
            PlayerID.Player4
        };

        if (RoundTracker.R.num_rounds == 2)
        {
            cIDList = new List <ControlID>()
            {
                ControlID.Runner,
                ControlID.Cannon1,
                ControlID.Cannon2,
                ControlID.Cannon3
            };
        }
        else if (RoundTracker.R.num_rounds == 3)
        {
            cIDList = new List <ControlID>()
            {
                ControlID.Cannon3,
                ControlID.Runner,
                ControlID.Cannon1,
                ControlID.Cannon2
            };
        }
        else if (RoundTracker.R.num_rounds == 4)
        {
            cIDList = new List <ControlID>()
            {
                ControlID.Cannon2,
                ControlID.Cannon3,
                ControlID.Runner,
                ControlID.Cannon1
            };
        }

        /*int i;
         * for (i = 0; i < numOfPlayers; i++)
         * {
         *  int idx = Random.Range(0, cIDList.Count);
         *  ControlID cID = cIDList[idx];
         *  cIDList.RemoveAt(idx);
         *  PlayerColor clr;
         *
         *  if (pIDList[i] == PlayerID.Player1)
         *  {
         *      clr = PlayerColor.Red;
         *  }
         *  else if (pIDList[i] == PlayerID.Player2)
         *  {
         *      clr = PlayerColor.Blue;
         *  }
         *  else if (pIDList[i] == PlayerID.Player3)
         *  {
         *      clr = PlayerColor.Green;
         *  }
         *  else
         *  {
         *      clr = PlayerColor.Yellow;
         *  }
         *
         *  setPlayerInfoForControlID(cID, pIDList[i], AIMode.Off, clr);
         * }
         *
         * foreach (ControlID cID in cIDList)
         * {
         *  PlayerColor clr;
         *
         *  if (pIDList[i] == PlayerID.Player1)
         *  {
         *      clr = PlayerColor.Red;
         *  }
         *  else if (pIDList[i] == PlayerID.Player2)
         *  {
         *      clr = PlayerColor.Blue;
         *  }
         *  else if (pIDList[i] == PlayerID.Player3)
         *  {
         *      clr = PlayerColor.Green;
         *  }
         *  else
         *  {
         *      clr = PlayerColor.Yellow;
         *  }
         *
         *  setPlayerInfoForControlID(cID, pIDList[i++], AIMode.On, clr);
         * }*/
        Debug.Log("PLAYERS = " + numOfPlayers);
        int idx;

        for (idx = 0; idx < numOfPlayers; idx++)
        {
            ControlID   cID  = cIDList[idx];
            PlayerID    pID  = ((PlayerID)idx + 1);
            PlayerColor pClr = ((PlayerColor)idx + 1);
            setPlayerInfoForControlID(cID, pID, AIMode.Off, pClr);
        }

        for (; idx < 4; idx++)
        {
            ControlID   cID  = cIDList[idx];
            PlayerID    pID  = ((PlayerID)idx + 1);
            PlayerColor pClr = ((PlayerColor)idx + 1);
            setPlayerInfoForControlID(cID, pID, AIMode.On, pClr);
        }
    }
示例#15
0
 public IControl GetControl(ControlID id)
 {
     return null;
 }