public IEnumerator ShootArrow(float seconds) { direction = shootTowards.position; yield return(new WaitForSeconds(seconds)); //hit Audio audioManager.Play(audioShoot); GameObject newObject = Instantiate(prefabArrow, placeholderArrow.position, Quaternion.identity); newObject.transform.localScale = placeholderArrow.lossyScale; Arrow arrowScript = newObject.GetComponent <Arrow>(); if (arrowScript != null) { arrowScript.ShootingArrow(direction, mPlayer, dmgBasic); } MagicBall magicScript = newObject.GetComponent <MagicBall>(); if (magicScript != null) { magicScript.FireMagic(direction, mPlayer, dmgBasic); } }
// unitys start function private void Start() { _PlayerMagic = player.GetComponent <MagicBall>(); _PlayerMov = player.GetComponent <PlayerMovement>(); thisObjCol.GetComponent <BoxCollider>(); }
public override void UseWeaponBasic(Animator anim) { GameObject newBall = Instantiate(prefabMagicBall, transform.position, transform.rotation); newBall.transform.localScale = transform.lossyScale; MagicBall magicScript = newBall.GetComponent <MagicBall>(); magicScript.FireMagic(direction, mPlayer, dmgBasic); }
// Initialization void Start() { controller = GameObject.FindWithTag("Player"); ball = obj.AddComponent <MagicBall>(); ball.myTimer = 5.0f; gameObject.SendMessage("PlaySoundThrow"); if (item = GameObject.FindWithTag("Key")) { keyExists = true; } }
void OnCollisionEnter(Collision sender) { if (sender.gameObject.tag != "Magic") { return; } MagicBall magic = sender.gameObject.GetComponent <MagicBall>(); if (magic.magicType == MagicBall.MagicType.Fire) { Destroy(gameObject); } }
// unitys start function void Start() { _playerScript = _playerObj.GetComponent <MagicBall>(); manaPotPickUp = 25; playerHealth = 100; playerCurrentHealth = playerHealth; playerHealthPickUp = 25; playerMaxHealth = 100; meleeEnemyDamage = 5; rb = GetComponent <Rigidbody>(); // Physics.IgnoreLayerCollision(9,10); }
// Unity start function void Start() { _playerScript = playerObj.GetComponentInChildren <MagicBall>(); col.GetComponent <CapsuleCollider>(); cameraPos = GameObject.FindGameObjectWithTag("MainCamera"); }
void Start() { scriptMagicBall = GetComponent <MagicBall>(); }