void Awake() { anim = GetComponent <Animator> (); playerMovement = GetComponent <PlayerMovementMult> (); currentHealth = startingHealth; //Get scene // scene = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<SceneFadeInOut> (); }
//Assign references protected void Assign() { //Assigning player components player = gameObject; //Since the skills will be a component to the player playerHealth = player.GetComponent <PlayerHealthMult> (); playerSkill = player.GetComponent <PlayerSkillMult> (); playerMovement = player.GetComponent <PlayerMovementMult> (); skillActivation = player.GetComponent <SkillActivation> (); button.image.sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; button.GetComponent <Button> ().onClick.AddListener(() => { Activate(); }); //Assigning skill effect to the button }
void Awake() { //get all the players on the scene GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); //Get the player that the enemy will track //It will track the player that is standing on the same 'bridge' for (int i = 0; i < players.Length; i++) { float playerLocationOffset = gameObject.transform.position.y - players[i].transform.position.y; if ((playerLocationOffset < Center) && (playerLocationOffset > -(Center))) { player = players[i].transform; playerMovement = players[i].GetComponent <PlayerMovementMult>(); } } enemyRigidbody2D = GetComponent <Rigidbody2D> (); facingRight = true; }
// Use this for initialization void Start() { playerHealth = gameObject.GetComponent <PlayerHealthMult> (); playerSkill = gameObject.GetComponent <PlayerSkillMult> (); playerMovement = gameObject.GetComponent <PlayerMovementMult> (); }