public void SwitchToThisControl(PlayerControlType playerControlType) { switch (playerControlType) { case PlayerControlType.PlayerOne: keyboardIcon.gameObject.SetActive(true); numpadIcon.gameObject.SetActive(false); aiIcon.gameObject.SetActive(false); break; case PlayerControlType.PlayerTwo: keyboardIcon.gameObject.SetActive(false); numpadIcon.gameObject.SetActive(true); aiIcon.gameObject.SetActive(false); break; case PlayerControlType.Computer: keyboardIcon.gameObject.SetActive(false); numpadIcon.gameObject.SetActive(false); aiIcon.gameObject.SetActive(true); break; default: break; } }
public void SetupController(PlayerControlType playerControlType) { switch (playerControlType) { case PlayerControlType.PlayerOne: nextSkill.transform.parent.gameObject.SetActive(true); prevSkill.transform.parent.gameObject.SetActive(true); nextSkill.text = "E"; prevSkill.text = "Q"; activateSkill.text = "F"; break; case PlayerControlType.PlayerTwo: nextSkill.transform.parent.gameObject.SetActive(true); prevSkill.transform.parent.gameObject.SetActive(true); nextSkill.text = "7"; prevSkill.text = "8"; activateSkill.text = "9"; break; case PlayerControlType.Computer: nextSkill.transform.parent.gameObject.SetActive(false); prevSkill.transform.parent.gameObject.SetActive(false); activateSkill.text = "-"; break; default: break; } }
public void ShowPlayerOne() { playerOneBtn.image.color = playerOneBtn.colors.pressedColor; playerTwoBtn.image.color = playerTwoBtn.colors.normalColor; currentControlShown = PlayerControlType.PlayerOne; playerOne.SetActive(true); playerTwo.SetActive(false); }
public PlayerType(PlayerControlType controlType, IOffscreenPlayerFactory offscreenPlayerFactory) { if (offscreenPlayerFactory == null) { throw new ArgumentNullException(nameof(offscreenPlayerFactory)); } this.ControlType = controlType; this.Name = offscreenPlayerFactory.Name; this.OffscreenPlayerFactory = offscreenPlayerFactory; }
public void ShowThisVisuals(int idx, PlayerControlType thisControl) { if (currentControlShown != thisControl) { return; } initialDetail.gameObject.SetActive(false); if (idx <= 3) { tileSwap.SetActive(true); unitSummon.SetActive(false); unitSelection.SetActive(false); skillSelect.SetActive(false); leaderSpawn.SetActive(false); } else if (idx == 4) { tileSwap.SetActive(false); unitSummon.SetActive(true); unitSelection.SetActive(false); skillSelect.SetActive(false); leaderSpawn.SetActive(false); } else if (idx > 4 && idx <= 8) { tileSwap.SetActive(false); unitSummon.SetActive(false); unitSelection.SetActive(true); skillSelect.SetActive(false); leaderSpawn.SetActive(false); } else if (idx == 9) { tileSwap.SetActive(false); unitSummon.SetActive(false); unitSelection.SetActive(false); skillSelect.SetActive(false); leaderSpawn.SetActive(true); } else if (idx >= 10 && idx <= 12) { tileSwap.SetActive(false); unitSummon.SetActive(false); unitSelection.SetActive(false); skillSelect.SetActive(true); leaderSpawn.SetActive(false); } }
/// <summary> /// Returns the specified control. /// </summary> /// <param name="type">The type of control.</param> /// <returns>The control.</returns> public Control this[PlayerControlType type] { get { switch (type) { case PlayerControlType.Thrust: return Thrust; case PlayerControlType.Left: return Left; case PlayerControlType.Right: return Right; case PlayerControlType.Fire1: return Fire1; case PlayerControlType.Fire2: return Fire2; case PlayerControlType.Extra: return Extra; default: throw new ArgumentException("Unknown control type " + type); } } }
public void ChangeControlType(PlayerControlType controlType) { if (controlType != ControlType) { //Drop Held Item if necessary } ControlType = controlType; RigidBodyParams param = new List <RigidBodyParams>(rigidbodyParams).Find(x => x.controlType == ControlType); rb.mass = param.mass; rb.drag = param.linearDrag; rb.angularDrag = param.angularDrag; rb.gravityScale = param.gravityScale; rb.freezeRotation = param.freezeRotation; gameObject.layer = LayerMask.NameToLayer(param.layer); var animator = GetComponent <Animator>(); switch (ControlType) { case PlayerControlType.MATCHER: animator.runtimeAnimatorController = MatcherController; break; case PlayerControlType.MOWER: animator.runtimeAnimatorController = MowerController; break; case PlayerControlType.DRILLER: animator.runtimeAnimatorController = DrillerController; break; case PlayerControlType.SHOOTER: animator.runtimeAnimatorController = ShooterController; break; default: break; } }
public void SetControlType(PlayerControlType curController, bool isAttacker) { controlType = curController; teamType = (isAttacker) ? TeamType.Attacker : TeamType.Defender; BattlefieldUIHandler myHandler = BattlefieldSceneManager.GetInstance.battleUIInformation; if (controlType == PlayerControlType.Computer) { isComputer = true; } else { isComputer = false; } if (BattlefieldSceneManager.GetInstance != null && !BattlefieldSceneManager.GetInstance.isCampaignMode) { if (isAttacker) { curColumnIdx = attackerColumnIdx; curRowIdx = attackerRowIdx; SetPointBehavior(); } else { curColumnIdx = defenderColumnIdx; curRowIdx = defenderRowIdx; SetPointBehavior(); } unitList[0].SetAsSelected(); selectedUnit = unitList[0]; } skillSlotHandler.SetupSkillSlots(); }
public void SetControlType(PlayerControlType thisControl) { controlType = thisControl; if (controlType == PlayerControlType.Computer) { computerControlled = true; readyTooltipObject.SetActive(false); } if (controlType == PlayerControlType.PlayerTwo) { computerControlled = false; readyTooltipObject.SetActive(true); readyLeft.text = "<-"; readyRight.text = "->"; } else if (controlType == PlayerControlType.PlayerOne) { computerControlled = false; readyTooltipObject.SetActive(true); readyLeft.text = "A"; readyRight.text = "D"; } }
public ControlState GetControlState(PlayerControlType controlType) { return ControlStates[(int)controlType]; }
public void AddControlState(PlayerControlType controlType, ControlState state) { ControlStates[(int)controlType] = ControlStates[(int)controlType].Add(state); }
public void SwitchDefenderControls(PlayerControlType newControlType) { battleUIInformation.defenderPanel.SetControlType(newControlType, false); battleUIInformation.defenderReportPanel.SetControlType(newControlType); }
public void SwitchAttackerControls(PlayerControlType newControlType) { battleUIInformation.attackerPanel.SetControlType(newControlType, true); battleUIInformation.attackerReportPanel.SetControlType(newControlType); }
public PlayerType(PlayerControlType controlType, IOffscreenPlayerFactory offscreenPlayerFactory, string name) : this(controlType, offscreenPlayerFactory) { this.Name = name; }
public PlayerType(PlayerControlType controlType, IOffscreenPlayerFactory offscreenPlayerFactory) { this.ControlType = controlType; this.Name = offscreenPlayerFactory.Name; this.OffscreenPlayerFactory = offscreenPlayerFactory; }
public PlayerType(PlayerControlType controlType, string name) { this.ControlType = controlType; this.Name = name; this.OffscreenPlayerFactory = null; }
public void SetData(Hashtable ht) { if(ht.ContainsKey("type")) { this.type = (PlayerControlType)System.Enum.Parse( typeof(PlayerControlType), (string)ht["type"]); if(this.IsDefaultControl()) { if(ht.ContainsKey("movedead")) this.moveDead = bool.Parse((string)ht["movedead"]); if(ht.ContainsKey("usecharacterspeed")) this.useCharacterSpeed = true; if(ht.ContainsKey("firstperson")) this.firstPerson = true; if(ht.ContainsKey("usecamdir")) this.useCamDirection = bool.Parse((string)ht["usecamdir"]); this.runSpeed = float.Parse((string)ht["runspeed"]); this.gravity = float.Parse((string)ht["gravity"]); this.speedSmoothing = float.Parse((string)ht["speedsmoothing"]); this.rotateSpeed = float.Parse((string)ht["rotatespeed"]); if(ht.ContainsKey("jumpduration")) { this.useJump = true; this.jumpDuration = float.Parse((string)ht["jumpduration"]); this.jumpSpeed = float.Parse((string)ht["jumpspeed"]); this.inAirModifier = float.Parse((string)ht["inairmodifier"]); if(ht.ContainsKey("jumpmaxgroundangle")) { this.jumpMaxGroundAngle = float.Parse((string)ht["jumpmaxgroundangle"]); } this.jumpInterpolation = (EaseType)System.Enum.Parse(typeof(EaseType), (string)ht["jumpinterpolation"]); } if(ht.ContainsKey("sprintfactor")) { this.useSprint = true; this.sprintFactor = float.Parse((string)ht["sprintfactor"]); if(ht.ContainsKey("useenergy")) { this.useEnergy = true; if(ht.ContainsKey("meformula")) { this.maxEFormula = true; this.meFormula = int.Parse((string)ht["meformula"]); } else if(ht.ContainsKey("maxenergy")) { this.maxEnergy = float.Parse((string)ht["maxenergy"]); } if(ht.ContainsKey("ecformula")) { this.energyCFormula = true; this.ecFormula = int.Parse((string)ht["ecformula"]); } else if(ht.ContainsKey("energyconsume")) { this.energyConsume = float.Parse((string)ht["energyconsume"]); } if(ht.ContainsKey("erformula")) { this.energyRFormula = true; this.erFormula = int.Parse((string)ht["erformula"]); } else if(ht.ContainsKey("energyregeneration")) { this.energyRegeneration = float.Parse((string)ht["energyregeneration"]); } } } } else if(this.IsMobileControl()) { this.mouseTouch.SetData(ht); if(ht.ContainsKey("movedead")) this.moveDead = bool.Parse((string)ht["movedead"]); if(ht.ContainsKey("usecharacterspeed")) this.useCharacterSpeed = true; this.runSpeed = float.Parse((string)ht["runspeed"]); this.gravity = float.Parse((string)ht["gravity"]); this.speedSmoothing = float.Parse((string)ht["speedsmoothing"]); this.raycastDistance = float.Parse((string)ht["raycastdistance"]); this.layerMask = int.Parse((string)ht["layermask"]); this.cursorOffset = new Vector3( float.Parse((string)ht["x"]), float.Parse((string)ht["y"]), float.Parse((string)ht["z"])); this.minimumMoveDistance = float.Parse((string)ht["minimummovedistance"]); this.ignoreYDistance = bool.Parse((string)ht["ignoreydistance"]); this.useEventMover = bool.Parse((string)ht["useeventmover"]); this.autoRemoveCursor = bool.Parse((string)ht["autoremovecursor"]); this.autoStopMove = bool.Parse((string)ht["autostopmove"]); } if(ht.ContainsKey(XMLHandler.NODES)) { ArrayList s = ht[XMLHandler.NODES] as ArrayList; foreach(Hashtable ht2 in s) { if(ht2[XMLHandler.NODE_NAME] as string == PlayerControlSettings.VERTICALAXIS) { this.verticalAxis = ht2[XMLHandler.CONTENT] as string; } else if(ht2[XMLHandler.NODE_NAME] as string == PlayerControlSettings.HORIZONTALAXIS) { this.horizontalAxis = ht2[XMLHandler.CONTENT] as string; } else if(ht2[XMLHandler.NODE_NAME] as string == PlayerControlSettings.CURSOROBJECT) { this.cursorObjectName = ht2[XMLHandler.CONTENT] as string; } else if(ht2[XMLHandler.NODE_NAME] as string == PlayerControlSettings.JUMPKEY) { this.jumpKey = ht2[XMLHandler.CONTENT] as string; } else if(ht2[XMLHandler.NODE_NAME] as string == PlayerControlSettings.SPRINTKEY) { this.sprintKey = ht2[XMLHandler.CONTENT] as string; } } } } }