public void OnSkillReady(Skill skill) { if (skill.type == SkillType.ORB && nextOrbSkill == null) { nextOrbSkill = (OrbSkill)skill; } }
public void NextPlayerAction() { if (!IsMoving()) { if (target != null) { LookToTarget(); if (attackController.CanAttack()) { attackController.Attack(target); } } } if (nextOrbSkill == null) { OrbSkill OrbSkill = GetNextReadyOrbSkill(); if (OrbSkill != null) { Debug.Log("next ready orb skill " + OrbSkill.name); nextOrbSkill = OrbSkill; attackController.CreateOrb(nextOrbSkill); } } }
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; }
public GameObject CreateOrbBullet(GameObject orbBulletObj, Transform start, GameObject owner, Vector3 targetPos, Transform target, float damageModifier = 1f) { OrbController orbController = orbBulletObj.GetComponent <OrbController>(); DistanceDestroy distanceDestroy = orbBulletObj.GetComponent <DistanceDestroy>(); SphereCollider bulletCollider = orbBulletObj.AddComponent <SphereCollider>(); OrbBullet bullet = orbBulletObj.AddComponent <OrbBullet>(); Rigidbody rigidbody = orbBulletObj.AddComponent <Rigidbody>(); OrbSkill skill = orbController.skill; Role ownerRole = owner.GetComponent <Role>(); ownerRole.GetSkillByName(skill.skillName).StartCD(); gizmosShootPoint = orbBulletObj.transform.position; Vector3 scale = start.localScale; orbBulletObj.transform.position = start.position; orbBulletObj.transform.rotation = start.rotation; orbBulletObj.transform.LookAt(target); orbBulletObj.transform.localScale = scale; gizmosShootPoint = orbBulletObj.transform.position; distanceDestroy.fixPosition = start.position; float raduis; bulletColliderRadius.TryGetValue(BulletSize.Mega, out raduis); bulletCollider.radius = raduis; bulletCollider.enabled = true; rigidbody.mass = 2; rigidbody.useGravity = false; rigidbody.constraints = RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX; bullet.orbSkill = skill; bullet.bulletSpeed = normalizeAttackSpeed(ownerRole.attribute.attackSpeed); bullet.creator = owner; bullet.damageModifier = damageModifier; bullet.direction = start.position - targetPos; GameObject bulletprojectile = Instantiate(skill.bulletPrafab); bulletprojectile.transform.SetParent(orbBulletObj.transform, false); GameObject bulletImpactPrafab = skill.bulletImpactPrafab; bullet.impectPrafab = bulletImpactPrafab; bullet.autoDestroyTime = 10; bullet.enhancement = GetBulletEnhancement(); bullet.EnhancementMerge(); bullet.PreEnhancementProcess(); bullet.ApplyForce(); orbController.caster = owner.GetComponent <Role>(); orbController.OrbAttackStart(); return(orbBulletObj); }