public override void Awake() { base.Awake(); playerMovementController = gameObject.GetComponentInParent <PlayerMovementController>(); playerController = GetComponent <PlayerController>(); alignment = AlignmentType.Player; GameObject gameManager = GameObject.FindGameObjectWithTag("GameController"); PrafabHolder prafabHolder = gameManager.GetComponent <PrafabHolder>(); GameObject MageFireBall = prafabHolder.GetSkill("MageFireBall"); AddSkill(MageFireBall); //GameObject BlizardSkill = prafabHolder.GetSkill("Blizard"); //AddSkill(BlizardSkill); //GameObject FireSpraySkill = prafabHolder.GetSkill("FireSpray"); //AddSkill(FireSpraySkill); //GameObject LightningStrick = prafabHolder.GetSkill("LightningStrick"); //AddSkill(LightningStrick); //GameObject AttackSpeedUp = prafabHolder.GetSkill("AttackSpeedUp"); //AddSkill(AttackSpeedUp); //GameObject AttackSpeedBuff1 = Instantiate(prafabHolder.GetBuff("attackSpeed")); //AddBuff(AttackSpeedBuff1, GetComponent<Role>()); //GameObject AttackSpeedBuff2 = Instantiate(prafabHolder.GetBuff("attackSpeed")); //AddBuff(AttackSpeedBuff2, GetComponent<Role>()); }
public void CreateOrb(OrbSkill skill) { nextObrBullet = Instantiate(prafabHolder.OrbBullet, player.GetShootPoint(ShootPointPosition.MID).position, Quaternion.identity); OrbController orbController = nextObrBullet.GetComponent <OrbController>(); orbController.skill = skill; orbController.caster = player; GameObject skillPrafab = prafabHolder.GetSkill(skill.skillName); OrbSkillController orbSkillControllerComponent = skill.GetComponent <OrbSkillController>(); OrbSkillController orbSkillController = (OrbSkillController)nextObrBullet.AddComponent(orbSkillControllerComponent.GetType()); orbSkillController.skill = skill; orbSkillController.creator = gameObject; orbController.orbSkillController = orbSkillController; //nextObrBullet.GetComponent<Bullet>().creator = gameObject; }
private GameObject AddSkillController(GameObject triggeredObject, ContactPoint contactPoint) { GameObject skillPrafab = prafabHolder.GetSkill(skill.skillName); OrbSkillController skillControllerPrafab = skill.GetComponent <OrbSkillController>(); GameObject skillHolder = Instantiate(prafabHolder.Skillholder, transform.position, Quaternion.identity);; OrbSkillController skillController = (OrbSkillController)skillHolder.AddComponent(skillControllerPrafab.GetType()); skillController.primaryTarget = triggeredObject; skillController.creator = caster.gameObject; skillController.skill = skill; skillController.primaryContactPoint = contactPoint; skillController.primaryTarget = triggeredObject; skillController.position1 = transform; orbSkillController = skillController; skill.skillControllerObj = skillHolder; return(skillHolder); }