// Start is called before the first frame update void Start() { this.transform.position = GlobalVariables.spawnPos; GlobalVariables.globalObjects["player"] = this.gameObject; controller = this.gameObject.GetComponent <CharacterMoverComponent>(); meleeAttack = this.gameObject.GetComponent <CharacterMeleeComponent>(); hud = this.gameObject.GetComponent <PlayerHUDComponent>(); vfx = this.gameObject.GetComponent <PlayerVFXComponent>(); level = this.gameObject.GetComponent <CharacterLevelComponent>(); animator = this.gameObject.GetComponent <Animator>(); animator.SetFloat("AnimSpeed", 1.0f); rangedAttack = GetComponent <CharacterRangedComponent>(); health = GetComponent <CharacterHealthComponent>(); health.health = PlayerStats.Health; health.maxHealth = PlayerStats.Maxhealth; hud.hasKey = PlayerStats.HasKey; hud.hasNecklace = PlayerStats.HasNecklace; level.XP = PlayerStats.Xp; level.level = PlayerStats.Level; level.levelUp = PlayerStats.Levelup; hud.hasSword = PlayerStats.HasSword; }
// Start is called before the first frame update void Start() { health = this.gameObject.GetComponent <CharacterHealthComponent>(); level = this.gameObject.GetComponent <CharacterLevelComponent>(); hasNecklace = false; hasKey = false; }
private void Start() { player = GameObject.Find("Player"); hud = player.GetComponent <PlayerHUDComponent>(); health = player.GetComponent <CharacterHealthComponent>(); level = player.GetComponent <CharacterLevelComponent>(); }
private Animator animator; //animator component // Start is called before the first frame update void Start() { controller = GetComponent <CharacterMoverComponent>(); melee = GetComponent <CharacterMeleeComponent>(); ranged = GetComponent <CharacterRangedComponent>(); level = GetComponent <CharacterLevelComponent>(); renderer = GetComponent <SpriteRenderer>(); patrolPoint = transform.position; following = false; moveDirection = RandomDirection(); animator = this.gameObject.GetComponent <Animator>(); if (player == null) { Object cache; if (GlobalVariables.globalObjects.TryGetValue("player", out cache)) { player = (GameObject)cache; } else { Debug.Log("player null"); } } }
void Start() { mask = LayerMask.GetMask(layerToHit); level = GetComponent <CharacterLevelComponent>(); animator = this.gameObject.GetComponent <Animator>(); }