protected override void Start() { base.Start(); action = GetComponentInParent <InputToAction>(); forwardShield.transform.SetParent(transform.root.Find("Rotating"), false); GetComponentInParent <IObservable <MovementAbilityFiredMessage> >().Subscribe <MovementAbilityFiredMessage>(this); }
protected override void onFire(Vector2 direction) { ready = false; Callback.CallbackMethod[] modifiers = new Callback.CallbackMethod[_opponents.Count]; for (int i = 0; i < _opponents.Count; i++) { InputToAction input = _opponents[i].GetComponent <InputToAction>(); modifiers[i] = () => input.normalizedMovementInput = -input.normalizedMovementInput; input.PreFixedUpdateDelegates.Add(modifiers[i]); GameObject visuals = SimplePool.Spawn(stunVisualsPrefab); visuals.transform.SetParent(_opponents[i], false); visuals.transform.localPosition = Vector3.zero; SpriteRenderer rend = visuals.GetComponent <SpriteRenderer>(); Callback.DoLerp((float l) => rend.color.setAlphaFloat(l), visualsLerpTime, this); Callback.FireAndForget(() => Callback.DoLerp((float l) => rend.color.setAlphaFloat(l), visualsLerpTime, this, reverse: true), duration - visualsLerpTime, this).FollowedBy(() => SimplePool.Despawn(visuals), this); } Callback.FireAndForget(() => { for (int i = 0; i < _opponents.Count; i++) { _opponents[i].GetComponent <InputToAction>().PreFixedUpdateDelegates.Remove(modifiers[i]); } }, duration, this); }
public void Notify(Message m) { switch (m.messageType) { case GoalScoredMessage.classMessageType: timer.running = false; Callback.FireAndForget(() => resetPositions(), goalToPlayerResetTime, this); break; case GameEndMessage.classMessageType: //add player stats data to the endData, once we figure out what stats to use for (int i = 0; i < players.Length; i++) { InputToAction playerControl = players[i].GetComponent <InputToAction>(); playerControl.movementEnabled = false; playerControl.abilitiesEnabled = false; playerControl.rotationEnabled = false; } data.Destruct(); Destroy(this.gameObject); break; case OvertimeMessage.classMessageType: AudioSource mainMusic = spawnedMainMusicPrefab.GetComponent <AudioSource>(); mainMusic.clip = overtimeClip; mainMusic.Play(); resetPositions(resetTime: false); break; } }
void SpawnPlayerRegistrationComponents(int playerID, GameObject spawnedPlayerRegistrationPuck, NetworkMode networkMode, int localID = -1) { CharacterSelector selector = spawnedPlayerRegistrationPuck.AddComponent <CharacterSelector>(); InputToAction action = spawnedPlayerRegistrationPuck.GetComponent <InputToAction>(); action.rotationEnabled = false; action.movementEnabled = true; Color playerColor; if (registeredPlayers.ContainsKey(playerID)) { playerColor = registeredPlayers[playerID].color; } else if (localID != -1) { playerColor = possiblePlayers[localID].color; } else { playerColor = HSVColor.HSVToRGB(Random.value, 1, 1); } registeredPlayers[playerID] = new Registration(selector, null, RegistrationState.REGISTERING, localID, networkMode, this); selector.gameObject.GetComponentInChildren <Image>().color = selector.gameObject.GetComponent <ParticleSystem>().startColor = registeredPlayers[playerID].color = playerColor; selector.registration = registeredPlayers[playerID]; }
protected override void Start() { base.Start(); action = GetComponentInParent <InputToAction>(); vfx.startSize = 2 * transform.parent.GetComponentInChildren <CircleCollider2D>().radius; rigid = GetComponentInParent <Rigidbody2D>(); interruptor = transform.root.AddComponent <Interrupt>(); }
public void Initialize(float duration, float massNerf, ContagionAbility origin, ContagionEffects effects) { this.duration = duration; this.origin = origin; this.effects = effects; this.massNerf = massNerf; action = GetComponent<InputToAction>(); }
public void Initialize(float duration, float massNerf, ContagionAbility origin, ContagionEffects effects) { this.duration = duration; this.origin = origin; this.effects = effects; this.massNerf = massNerf; action = GetComponent <InputToAction>(); }
protected override void Start() { base.Start(); action = GetComponentInParent<InputToAction>(); Side side = GetComponentInParent<Stats>().side; instantiatedShot = Instantiate(shotPrefab).GetComponent<SkillShotBullet>(); instantiatedShot.Initialize(side, this); instantiatedShot.Active = false; }
protected override void Start() { action = GetComponentInParent <InputToAction>(); defaultAbilityUI = transform.parent.GetComponentInChildren <AbilityUIParent>().gameObject; normalVisuals = transform.parent.GetComponentInChildren <AbstractPlayerVisuals>().gameObject; ensureInstantiation(); base.Start(); //ready = true; //for easy testing }
// Update is called once per frame void FixedUpdate() { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); if (Script.frozen == false) { ////// NEED TO PUT THIS BACK IN EVENTUALLY //intendedLinkLength = GameObject.Find("GlobalController").GetComponent<GraphController>().LinkLength; //forceStrength = GameObject.Find("GlobalController").GetComponent<GraphController>().forceStrength; // moved from Start() in Update(), otherwise it won't see runtime updates of intendedLinkLength intendedLinkLengthSqr = intendedLinkLength * intendedLinkLength; lineRenderer.SetPosition(0, source.transform.position); lineRenderer.SetPosition(1, 0.75f * source.transform.position + 0.25f * target.transform.position); lineRenderer.SetPosition(2, 0.25f * source.transform.position + 0.75f * target.transform.position); lineRenderer.SetPosition(3, target.transform.position); AnimationCurve curve = new AnimationCurve(); curve.AddKey(0f, 0.4f); curve.AddKey(0.2f, 0.1f); curve.AddKey(0.8f, 0.1f); curve.AddKey(1.0f, 0.4f); lineRenderer.widthCurve = curve; doAttraction(); } /* * GlobalScalers Script = GameObject.FindGameObjectWithTag("GameController").GetComponent<GlobalScalers>(); * print("Script.largestLink: " + Script.largestLink); * weightscale = Script.largestLink; * * * if (direction == true) * { * lineRenderer.startWidth = 0.5f*weight/weightscale; * lineRenderer.endWidth = 0.1f*weight/weightscale; * * } * else * { * lineRenderer.startWidth = 0.25f*weight/weightscale; * lineRenderer.endWidth = 0.25f*weight/weightscale; * * } */ //Make line flash between red and green //lineRenderer.material.color = Color.Lerp(colorStart, colorEnd, (Mathf.PingPong(Time.time, 1) / 1)); }
protected override void Start() { base.Start(); action = GetComponentInParent <InputToAction>(); Side side = GetComponentInParent <Stats>().side; instantiatedShot = Instantiate(shotPrefab).GetComponent <SkillShotBullet>(); instantiatedShot.Initialize(side, this); instantiatedShot.Active = false; }
protected override void Start() { action = GetComponentInParent<InputToAction>(); defaultAbilityUI = transform.parent.GetComponentInChildren<AbilityUIParent>().gameObject; normalVisuals = transform.parent.GetComponentInChildren<AbstractPlayerVisuals>().gameObject; ensureInstantiation(); base.Start(); //ready = true; //for easy testing }
private void handlePush(object sender, Control3DEventArgs e) { if (start > 0) { VRTK_Logger.Info("Pushed"); InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.FreezeAll(); print("pressed"); } start = 1; }
void OnTriggerExit2D(Collider2D other) { if (other.CompareTag(Tags.player)) { InputToAction otherController = other.GetComponentInParent <InputToAction>(); if (modifiers.ContainsKey(otherController)) { otherController.maxSpeedTracker.removeModifier(modifiers[otherController]); modifiers.Remove(otherController); } } }
// Update is called once per frame void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag(Tags.player)) { if (other.GetComponentInParent <Stats>().side != _side) { InputToAction otherController = other.GetComponentInParent <InputToAction>(); if (!modifiers.ContainsKey(otherController)) { modifiers[otherController] = otherController.maxSpeedTracker.addModifier(speedNerf); } } } }
public void Initialize(InputToAction mirrorTarget) { this.mirrorTarget = mirrorTarget; mirrorRigidbody = mirrorTarget.GetComponent<Rigidbody2D>(); visuals = Instantiate(mirrorTarget.GetComponentInChildren<AbstractPlayerVisuals>().gameObject).GetComponent<AbstractPlayerVisuals>(); visuals.transform.SetParent(this.transform, false); visuals.transform.localPosition = Vector3.zero; GetComponent<StatsReference>().referencedStat = mirrorTarget.GetComponent<Stats>(); UpdateMirror(); mirrorTarget.PostFixedUpdateDelegates.Add(UpdateMirror); if (reverseInputOnMirror) mirrorTarget.PreFixedUpdateDelegates.Add(ReverseInput); }
// Update is called once per frame void FixedUpdate() { //sphRadiusSqr = repulseStrength; // Doesn't make a noticable difference withouth the script.frozen for fps InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); if (Script.frozen == false) { ////////// AGAIN, NEED TO ADD THIS BACK SOMEDAY //sphRadius = GameObject.Find("GlobalController").GetComponent<GraphController>().sphRadius; //repulse = GameObject.Find("GlobalController").GetComponent<GraphController>().repulse; //sphRadiusSqr = sphRadius * sphRadius; doRepulse(); } }
public void Initialize(InputToAction mirrorTarget) { this.mirrorTarget = mirrorTarget; mirrorRigidbody = mirrorTarget.GetComponent <Rigidbody2D>(); visuals = Instantiate(mirrorTarget.GetComponentInChildren <AbstractPlayerVisuals>().gameObject).GetComponent <AbstractPlayerVisuals>(); visuals.transform.SetParent(this.transform, false); visuals.transform.localPosition = Vector3.zero; GetComponent <StatsReference>().referencedStat = mirrorTarget.GetComponent <Stats>(); UpdateMirror(); mirrorTarget.PostFixedUpdateDelegates.Add(UpdateMirror); if (reverseInputOnMirror) { mirrorTarget.PreFixedUpdateDelegates.Add(ReverseInput); } }
bool hitTarget(Transform hit, float stunTime) { InputToAction input = hit.GetComponent <InputToAction>(); if (input != null) { Stats otherStats = hit.GetComponent <Stats>(); if (otherStats.side != myStats.side) { input.DisableMovement(stunTime); GameObject visuals = SimplePool.Spawn(hitVisualsPrefab); visuals.transform.SetParent(hit); visuals.transform.localPosition = Vector3.zero; hitVisuals.Add(visuals); return(true); } } return(false); }
public void Notify(IncomingNetworkStreamMessage m) { switch (m.packetType) { case PacketType.SUPERGOALSPAWNING: int spawnPointIndex = m.reader.ReadByte(); spawnSuperGoals(spawnPointIndex); break; case PacketType.SUPERGOALSCORED: int playerID = m.reader.ReadByte(); GameObject player = InputToAction.IDToInputToAction(playerID).gameObject; player.GetComponentInChildren <SuperAbility>().ready = true; playFX(player.GetComponent <Stats>().side); break; default: Debug.LogError("Invalid Message Type"); break; } }
// Use this for initialization protected virtual void Start() { action = GetComponent <InputToAction>(); setInputToActionAimingDelegates(); }
protected override void Start() { action = GetComponentInParent<InputToAction>(); base.Start(); }
// Use this for initialization protected virtual void Start() { action = GetComponent<InputToAction>(); setInputToActionAimingDelegates(); }
protected virtual void Awake() { controller = GetComponent <InputToAction>(); }
protected override void Start() { action = GetComponentInParent <InputToAction>(); base.Start(); }
public NetworkPlayerIdentity(int playerID, NetworkMode networkState, InputToAction inputToAction) { this.playerID = playerID; this.networkMode = networkState; this.inputToAction = inputToAction; }
void spawnPlaygroundAvatar(int playerID) { Registration data = registeredPlayers[playerID]; CharacterComponents character = charactersData[data.SelectedCharacterID].character; GameObject spawnedPlayer = (GameObject)Instantiate(character.basePlayer); spawnedPlayer.AddComponent <OutOfBoundsCheck>().Init(new Vector2(-horizontalBounds, -verticalBounds), new Vector2(horizontalBounds, verticalBounds)); Stats spawnedStats = spawnedPlayer.AddComponent <Stats>(); spawnedStats.side = character.side; spawnedStats.playerID = playerID; spawnedStats.networkMode = data.networkMode; AbstractPlayerInput input; switch (data.networkMode) { case NetworkMode.REMOTECLIENT: case NetworkMode.REMOTESERVER: break; default: if (data.localID != -1) { switch (possiblePlayers[data.localID].bindings.inputMode) { case InputConfiguration.PlayerInputType.MOUSE: input = spawnedPlayer.AddComponent <MousePlayerInput>(); input.bindings = possiblePlayers[data.localID].bindings; break; case InputConfiguration.PlayerInputType.JOYSTICK: input = spawnedPlayer.AddComponent <JoystickCustomDeadZoneInput>(); input.bindings = possiblePlayers[data.localID].bindings; break; } } break; } GameObject movementAbility = GameObject.Instantiate(character.movementAbility); movementAbility.GetComponentInChildren <NotSuperAbility>().cooldownTime /= 4; movementAbility.transform.SetParent(spawnedPlayer.transform, false); GameObject genericAbility = GameObject.Instantiate(character.genericAbility); genericAbility.GetComponentInChildren <NotSuperAbility>().cooldownTime /= 4; genericAbility.transform.SetParent(spawnedPlayer.transform, false); GameObject.Instantiate(nullSuperPrefab).transform.SetParent(spawnedPlayer.transform, false); GameObject instantiatedMeshInteraction = GameObject.Instantiate(meshInteraction); instantiatedMeshInteraction.transform.SetParent(spawnedPlayer.transform, false); instantiatedMeshInteraction.GetComponent <ParticleSystem>().startColor = data.localID != -1 ? possiblePlayers[data.localID].color : data.color; GameObject visuals = GameObject.Instantiate(character.visuals); visuals.transform.SetParent(spawnedPlayer.transform, false); IHueShiftableVisuals huedVisuals = visuals.GetComponent <IHueShiftableVisuals>(); if (huedVisuals != null) { data.playgroundAvatarVisuals = huedVisuals; huedVisuals.shiftAsync = data.ui.CharacterVisualsVector; } data.playgroundAvatar = spawnedPlayer; InputToAction action = spawnedPlayer.GetComponent <InputToAction>(); action.movementEnabled = true; action.abilitiesEnabled = true; switch (character.side) { case Side.LEFT: leftPlayers.Add(spawnedPlayer.transform); break; case Side.RIGHT: rightPlayers.Add(spawnedPlayer.transform); break; } foreach (AbstractAbility ability in spawnedPlayer.GetComponentsInChildren <AbstractAbility>()) { if (ability is IOpponentsAbility) { switch (character.side) { case Side.LEFT: (ability as IOpponentsAbility).opponents = rightPlayers; break; case Side.RIGHT: (ability as IOpponentsAbility).opponents = leftPlayers; break; } } if (ability is IAlliesAbility) { switch (character.side) { case Side.LEFT: (ability as IAlliesAbility).allies = leftPlayers; break; case Side.RIGHT: (ability as IAlliesAbility).allies = rightPlayers; break; } } if (ability is IPuckAbility) { (ability as IPuckAbility).puck = puck.transform; } } //Callback.FireForUpdate(() => spawnedPlayer.GetComponent<ResetScripting>().Reset(echoPosition, 0f), this); }
// Use this for initialization void Awake() { action = GetComponent <InputToAction>(); vfx = GetComponent <VisualAnimate>(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.KeypadPlus)) { if (debug) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.TestPrint(); } } if (Input.GetKeyDown(KeyCode.KeypadMinus)) { if (debug) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); for (int i = 0; i < 100; i++) { Script.NewRandomNode(); } } } if (Input.GetKeyDown(KeyCode.KeypadEnter)) { if (debug) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.FreezeAll(); } } if (Input.GetKeyDown(KeyCode.KeypadPeriod)) { if (debug) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.UnFreezeAll(); } } if (Input.GetKeyDown(KeyCode.Delete)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.DeleteGraph(); print("deleted"); } if (Input.GetKeyDown(KeyCode.Keypad1)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.DeleteGraph(); } if (Input.GetKeyUp(KeyCode.Keypad1)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.LoadGraph(xmlRawFile); } if (Input.GetKeyUp(KeyCode.Keypad7)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.ToggleNames(); } if (Input.GetKeyUp(KeyCode.Keypad4)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.SpawnNode(); } if (Input.GetKeyUp(KeyCode.Keypad5)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.SpawnLink(); } if (Input.GetKeyUp(KeyCode.R)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.UpdateGraph(); } if (Input.GetKeyUp(KeyCode.T)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.Save(); } if (Input.GetKeyUp(KeyCode.V)) { InputToAction Script = GameObject.FindGameObjectWithTag("GameController").GetComponent <InputToAction>(); Script.BlurScreen(); } }