void Update() { if (HP <= 0) { gm.Win(false); } HPSlider.value = -((HP / HPmax) * 100); foreach (var kp in patternBindings) { if (Input.GetKeyDown(kp.Key)) { if (GameGUIManager.IsSpellcardInCooldown(kp.Value - 1)) { continue; } Debug.Log(kp.Value != activePattern); if (kp.Value != activePattern) { ActivateSpellCard(kp.Value); } } } Vector2 move = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); rigidbody.velocity = move; transform.position = new Vector3(Mathf.Clamp(transform.position.x, -6f, 2f), Mathf.Clamp(transform.position.y, -1.5f, 4.8f), 0); }
void ActivateSpellCard(int spellcardIndex) { int oldActivePattern = activePattern; activePattern = spellcardIndex; foreach (var particleSystem in patterns[oldActivePattern].particleSystems) { var emission = particleSystem.emission; particleSystem.Stop(); emission.enabled = false; } foreach (var particleSystem in patterns[activePattern].particleSystems) { var emission = particleSystem.emission; particleSystem.Play(); emission.enabled = true; } if (spellcardIndex != 0) { GameGUIManager.ActivateSpellCard(activePattern - 1, patterns[activePattern].cooldown, patterns[activePattern].duration); StartCoroutine(RestartDefaultPattern(patterns[activePattern].duration)); } }
void Awake() { if (mInst == null) { mInst = this; } //DontDestroyOnLoad(this); }
/// <summary> /// Initialize /// </summary> void Awake() { if (use != null) { Destroy(use.gameObject); } use = this; MessengerAM.Listen("game flow", this); MessengerAM.Listen(MessengerAM.listenTypeConfig, this); Messenger<int>.AddListener(BottomTrayGUI.kPaintSelectionInputMode, SetInputSelection); InitializeGUI(); // just add a call to this here too, so things that need public attributes will have them before Start() is called }
private void Awake() { if (instance == null) { //If I am the first instance, make me the Singleton instance = this; DontDestroyOnLoad(this); } else { Destroy(this.gameObject); } base.Awake(); }
// Use this for initialization void Start() { nView = GetComponent <NetworkView>(); cam = GetComponentInChildren <Camera>(); originAudio = shotOrigin.GetComponent <AudioSource>(); playerAudio = GetComponent <AudioSource>(); hitSound = GameSoundManager.instance.hit; shotSound = GameSoundManager.instance.shot; gameGUIManager = GameGUIManager.instance; fps = GetComponent <FirstPersonController>(); shootAnim = GetComponentInChildren <Animator>(); shotLight = GetComponent <Light>(); shotSystem = shotOrigin.GetComponent <ParticleSystem>(); weaponRenderer = weapon.GetComponent <Renderer>(); weaponRenderer.material = new Material(Shader.Find("Diffuse")); shotDispersion = 0; currentShotLevelInt = 0; currentShotLevel = shotLevels[0]; bulletsForThisLevel = shotLevels[0].availableBullets; weaponRenderer.material.color = shotLevels[0].colorRay; availableBulletsText.text = bulletsForThisLevel.ToString(); }
void Awake() { instance = this; }