public void InstantiateAttack(Transform pTarget) { Vector3 offset = transform.position + transform.forward * _attackOffset.x + Vector3.up * _attackOffset.y; MagicBolt attack = Instantiate(_attackPrefab, offset, Quaternion.identity).GetComponent <MagicBolt>(); attack.TransformToFollow = pTarget; attack.CheckPoint = _checkPoint; }
public static void playAnimation(BaseClass source, BaseClass target, BaseAbility ability) { UnityEngine.GameObject sour; UnityEngine.GameObject tar; //ADDED THIS VARIABLE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GameObject abil; if (source == TurnBasedCombatStateMachine.battleStateStartScript.EnemyOne) { sour = GameObject.Find("EnemyOne").gameObject; } else if (source == TurnBasedCombatStateMachine.battleStateStartScript.EnemyTwo) { sour = GameObject.Find("EnemyTwo").gameObject; } else if (source == TurnBasedCombatStateMachine.battleStateStartScript.EnemyThree) { sour = GameObject.Find("EnemyThree").gameObject; } else if (source == TurnBasedCombatStateMachine.battleStateStartScript.MC) { sour = GameObject.Find("Mitch").gameObject; } else if (source == TurnBasedCombatStateMachine.battleStateStartScript.ratKing) { sour = GameObject.Find("RatKing").gameObject; } else //(source == TurnBasedCombatStateMachine.battleStateStartScript.nathan) { sour = GameObject.Find("Nathan").gameObject; } if (target == TurnBasedCombatStateMachine.battleStateStartScript.EnemyOne) { tar = GameObject.Find("EnemyOne").gameObject; } else if (target == TurnBasedCombatStateMachine.battleStateStartScript.EnemyTwo) { tar = GameObject.Find("EnemyTwo").gameObject; } else if (target == TurnBasedCombatStateMachine.battleStateStartScript.EnemyThree) { tar = GameObject.Find("EnemyThree").gameObject; } else if (target == TurnBasedCombatStateMachine.battleStateStartScript.MC) { tar = GameObject.Find("Mitch").gameObject; } else if (target == TurnBasedCombatStateMachine.battleStateStartScript.ratKing) { tar = GameObject.Find("RatKing").gameObject; } else //(target == TurnBasedCombatStateMachine.battleStateStartScript.nathan) { tar = GameObject.Find("Nathan").gameObject; } //aDDED THIS SHIT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if (!TurnBasedCombatStateMachine.battleCalcScript.miss) { if (ability.AbilityName == "Gator Bite") { GameObject theGatorAttack = GameObject.Find("GatorBite0000").gameObject; GatorBite playerScript = theGatorAttack.GetComponent <GatorBite>(); Debug.Log("BIG GATOR ATTACK"); //tar.transform.position = tar.transform.position + new Vector3(10, 10, 0); playerScript.getInfo(tar, sour, theGatorAttack); //abil.GetComponent<GatorBite>().getInfo(tar, sour); } else if (ability.AbilityName == "Rat Throw") { GameObject theAttack = GameObject.Find("RatProjectileTrans").gameObject; RatThrow playerScript = theAttack.GetComponent <RatThrow>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "Rat Wall") { GameObject theAttack = GameObject.Find("RatWall0002").gameObject; RatWall playerScript = theAttack.GetComponent <RatWall>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "Steal Cat") { GameObject theAttack = GameObject.Find("cat").gameObject; StealCat playerScript = theAttack.GetComponent <StealCat>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "Spill Ranch") { GameObject theAttack = GameObject.Find("RatProjectileTrans").gameObject; RatThrow playerScript = theAttack.GetComponent <RatThrow>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "Cinder Strike") { GameObject theAttack = GameObject.Find("MitchAttack0008 (1)").gameObject; MitchAttack playerScript = theAttack.GetComponent <MitchAttack>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "Box Wine") { GameObject theAttack = GameObject.Find("RedBoxWine").gameObject; BoxWine playerScript = theAttack.GetComponent <BoxWine>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "Airblast") { GameObject theAttack = GameObject.Find("BasicWindAttack0003").gameObject; BasicWindAttack playerScript = theAttack.GetComponent <BasicWindAttack>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "Stomp") { GameObject theAttack = GameObject.Find("boot").gameObject; Boot playerScript = theAttack.GetComponent <Boot>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "magicbolt") { GameObject theAttack = GameObject.Find("Trail").gameObject; MagicBolt playerScript = theAttack.GetComponent <MagicBolt>(); playerScript.getInfo(tar, sour); } else if (ability.AbilityName == "throwcard") { GameObject theAttack = GameObject.Find("jace").gameObject; CardAttack playerScript = theAttack.GetComponent <CardAttack>(); playerScript.getInfo(tar, sour); } else { ability.UseAbility(tar, sour); Debug.Log("BIG LAME ATTACK"); } } }