// Use this for initialization void Start() { //Set instance to player character if (instance == null) { instance = this; } else { if (instance != this) { Destroy(gameObject); //Destroy instance if there is more than one } } DontDestroyOnLoad(gameObject); //Dont destroy player character when loading into new level currentState = PlayerState.walk; //Set players initial state sfxMan = FindObjectOfType <sfxManager>(); myAnim.SetFloat("moveX", 0); // X value for animator myAnim.SetFloat("moveY", -1); // Y value for animator currentHealth.RuntimeValue = 8.0f; playerHealthSignal.Raise(); }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); sfMan = FindObjectOfType <sfxManager>(); area1 = false; area2 = false; cancast = false; casted = false; }
void Update() { if (sfxMan == null) { sfxMan = FindObjectOfType <sfxManager>(); } if (dm == null) { dm = FindObjectOfType <DamageManager>(); } }
void Awake() { if (Instance) { DestroyImmediate(gameObject); } else { DontDestroyOnLoad(gameObject); Instance = this; } }
// Start is called before the first frame update void Start() { if (PlayerPrefs.HasKey("currentShipIndex")) { currentPlayerShip = PlayerPrefs.GetInt("currentShipIndex"); } GameObject shipModel = GameObject.Instantiate(shipModelArray[currentPlayerShip]); shipModel.transform.SetParent(transform); shipModel.transform.position = new Vector3(-7, 0, 0); animator = GetComponentInChildren <Animator>(); if (!shieldOn) { shieldObject.SetActive(false); } uI = GameObject.Find("Canvas").GetComponent <UIController>(); levelController = GameObject.Find("LevelController").GetComponent <LevelController>(); Debug.Log(levelController); fuel = levelController.startingFuel; //Getting initial position info: initPlayerPosition = transform.position.x; playerPosition = initPlayerPosition; //Making sure initial speed is set to 0: playerSpeed = 0; //Grabbing the Rigidbody2D component playerRigidBody = this.gameObject.GetComponent <Rigidbody2D>(); //Checking that we have the animator: if (animator == null) { animator = GameObject.Find("thrustAnimation").GetComponent <Animator>(); } if (constantForwardBurn) { Debug.Log("Turning animation on"); animator.SetBool("UnderThrust", true); } else { Debug.Log("Animation not on"); } soundEffects = GameObject.Find("GameController").GetComponent <sfxManager>(); //Update the fuel counter: uI.OnUpdateFuelText(fuel); Debug.Log("Completed ship startup"); }
// Use this for initialization void Start() { currentLevel = 1; currentExperience = 0; maxExperience = currentLevel * 100; sfxman = FindObjectOfType <sfxManager>(); dm = FindObjectOfType <DamageManager>(); phm = FindObjectOfType <PlayerHealthManager>(); if (!exists) { exists = true; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } }
// Use this for initialization void Start() { myRigidbody = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); sf = FindObjectOfType <ScreenFader>(); dm = FindObjectOfType <DialogueManager>(); sfxMan = FindObjectOfType <sfxManager>(); if (!exists) { exists = true; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } }
void Start() { sfxMan = FindObjectOfType <sfxManager>(); }
// Start is called before the first frame update void Start() { playerObj = GameObject.Find("Player"); soundEffects = GameObject.Find("GameController").GetComponent <sfxManager>(); }
private void Awake() { health = maxHealth.initialValue; //starting function for enemies sfxMan = FindObjectOfType <sfxManager>(); // }