private void Awake() { mainCamera = Camera.main; damageableEntity = GetComponent <DamageableEntity>(); InputController.Initialize(); //TODO Buscar una MUCHA mejor manera de llamar a esto. heroWeapon = gameObject.GetComponent <HeroWeapon>(); damageableEntity.onDeath += () => EventsManager.DispatchEvent(new ParticleEvent(PrefabID.HeroDeath, transform.position, Quaternion.identity)); damageableEntity.onDeath += () => EventsManager.DispatchEvent(new SoundEvent(SoundID.HeroDeath, transform.position)); }
public void InitWeapon(HeroWeapon weapon) { // Set start rotation and save current var currentRotation = transform.rotation; transform.rotation = _startRotation; // Create weapon and set transform for him Weapon = Instantiate(weapon); Weapon.transform.parent = transform; Weapon.transform.position = new Vector2(transform.position.x + weapon.transform.position.x, transform.position.y + weapon.transform.position.y); // Return curent rotation transform.rotation = currentRotation; }
private void Initialize() { heroMovement = gameObject.GetComponent <HeroMovement>(); heroWeapon = gameObject.GetComponent <HeroWeapon>(); }
private void OnEnable() { itemsList = new List <Gun>(); he = GetComponent <HeroComponents>(); we = GetComponent <HeroWeapon>(); }
void Awake() { spawnPoint = transform.FindChild("HWeaponSpawnPoint"); heroWeapon = this; }