public void SetSkillsToHand(BaseSkillBehaviour thisSkill) { if (skillsOnHand[0] == null) { skillsOnHand[0] = thisSkill; leftHandSkill = true; } else if (skillsOnHand[0] != null) { if (isDualCaster) { skillsOnHand[1] = thisSkill; rightHandSkill = true; } } }
public void ActivateSkill(UnitBaseBehaviourComponent skillOwner) { if (skillType == SkillType.Buff) { Vector3 postAdjustment = positionAdjustment + skillOwner.transform.position; GameObject tmp = GameObject.Instantiate(prefab, postAdjustment, Quaternion.Euler(rotationAdjustment.x, rotationAdjustment.y, rotationAdjustment.z), skillOwner.transform); BaseSkillBehaviour skillTmp = tmp.GetComponent <BaseSkillBehaviour>(); skillTmp.InitializeSkill(skillOwner, SkillType.Buff, targetType, spawnType, behaviourType); } else if (skillType == SkillType.Projectile) { Vector3 postAdjustment = positionAdjustment + skillOwner.transform.position; if (StartAtFront) { postAdjustment = skillOwner.transform.forward + skillOwner.transform.position; rotationAdjustment = new Vector3(skillOwner.transform.rotation.x, skillOwner.transform.rotation.y, skillOwner.transform.rotation.z); } if (skillOwner.targetUnit != null) { skillOwner.MakeUnitLookAt(skillOwner.targetUnit.transform.position); } GameObject tmp = GameObject.Instantiate(prefab, postAdjustment, Quaternion.Euler(rotationAdjustment.x, rotationAdjustment.y, rotationAdjustment.z), null); BaseSkillBehaviour skillTmp = tmp.GetComponent <BaseSkillBehaviour>(); skillTmp.InitializeSkill(skillOwner, SkillType.Projectile, targetType, spawnType, behaviourType); } else if (skillType == SkillType.TargetProjectile) { GameObject tmp = GameObject.Instantiate(prefab, skillOwner.transform.position, Quaternion.Euler(rotationAdjustment.x, rotationAdjustment.y, rotationAdjustment.z), null); BaseSkillBehaviour skillTmp = tmp.GetComponent <BaseSkillBehaviour>(); skillTmp.InitializeSkill(skillOwner, SkillType.TargetProjectile, targetType, spawnType, behaviourType); skillTmp.startAiming = true; // Targetable Projectile should not be here, place it to your unit //PlayerUnitController.GetInstance.targetableProjectile = skillTmp; if (PlayerUnitController.GetInstance.manualControlledUnit != null) { PlayerUnitController.GetInstance.manualControlledUnit.mySkills.SetSkillsToHand(skillTmp); } CursorManager.GetInstance.CursorChangeTemporary(CursorType.CLICKABLE_SKILLHOLD); } }