public static bool abilityEnabled(int abilityIndex) { GameObject playerObject = Managers.Player.gameObject; switch (abilityIndex) { case (int)Cheat.FORCE_LAUNCH: ForceLaunchAbility fta = playerObject.GetComponent <ForceLaunchAbility>(); return(fta.Active); case (int)Cheat.WALL_CLIMB: WallClimbAbility wca = playerObject.GetComponent <WallClimbAbility>(); return(wca.Active); case (int)Cheat.ELECTRIC_BEAM: ElectricBeamAbility eba = playerObject.GetComponent <ElectricBeamAbility>(); return(eba.Active); case (int)Cheat.SWAP: SwapAbility sa = playerObject.GetComponent <SwapAbility>(); return(sa.Active); case (int)Cheat.AIR_SLICE: AirSliceAbility asa = playerObject.GetComponent <AirSliceAbility>(); return(asa.Active); case (int)Cheat.LONG_TELEPORT: LongTeleportAbility lta = playerObject.GetComponent <LongTeleportAbility>(); return(lta.Active); default: throw new System.ArgumentException("abilityIndex is invalid!: " + abilityIndex); } }
// Use this for initialization void Start() { rb2d = GetComponent <Rigidbody2D>(); pc2d = GetComponent <PolygonCollider2D>(); gravity = GetComponent <GravityAccepter>(); mainCamCtr = Camera.main.GetComponent <CameraController>(); gm = GameObject.FindGameObjectWithTag("GestureManager").GetComponent <GestureManager>(); halfWidth = GetComponent <SpriteRenderer>().bounds.extents.magnitude; hm = GetComponent <HardMaterial>(); hm.shattered += shattered; fta = GetComponent <ForceTeleportAbility>(); wca = GetComponent <WallClimbAbility>(); sba = GetComponent <ShieldBubbleAbility>(); teleportRangeParticalController = teleportRangeParticalObject.GetComponent <ParticleSystemController>(); }
public static void enableAbility(int abilityIndex) { GameObject playerObject = GameManager.getPlayerObject(); switch (abilityIndex) { case 1: ForceTeleportAbility fta = playerObject.GetComponent <ForceTeleportAbility>(); fta.enabled = !fta.enabled; break; case 2: WallClimbAbility wca = playerObject.GetComponent <WallClimbAbility>(); wca.enabled = !wca.enabled; break; case 3: ShieldBubbleAbility sba = playerObject.GetComponent <ShieldBubbleAbility>(); sba.enabled = !sba.enabled; break; } }
public static void enableAbility(int abilityIndex, bool enable) { GameObject playerObject = Managers.Player.gameObject; switch (abilityIndex) { case (int)Cheat.FORCE_LAUNCH: ForceLaunchAbility fta = playerObject.GetComponent <ForceLaunchAbility>(); fta.Active = enable; break; case (int)Cheat.WALL_CLIMB: WallClimbAbility wca = playerObject.GetComponent <WallClimbAbility>(); wca.Active = enable; break; case (int)Cheat.ELECTRIC_BEAM: ElectricBeamAbility eba = playerObject.GetComponent <ElectricBeamAbility>(); eba.Active = enable; break; case (int)Cheat.SWAP: SwapAbility sa = playerObject.GetComponent <SwapAbility>(); sa.Active = enable; break; case (int)Cheat.AIR_SLICE: AirSliceAbility asa = playerObject.GetComponent <AirSliceAbility>(); asa.Active = enable; break; case (int)Cheat.LONG_TELEPORT: LongTeleportAbility lta = playerObject.GetComponent <LongTeleportAbility>(); lta.Active = enable; break; } }