private void Start() { targeter = Manager.Instance.SkillTargeter.GetComponent <SkillTargeter>(); skill = skillObject.GetComponent <SkillBehaviour>(); uiSprite.sprite = skill.UiSprite; EventManager.Instance.OnCancelSkillEvent += Reset; }
public void InitBullet(SkillBehaviour _belongSkill, OptionalImpact optionalEffectMethod = null, GameObject specifiedHitEffect = null) { belongSkill = _belongSkill; owner = belongSkill.Mc; speed = belongSkill.skillDataInstance.bulletSpeed; damage = belongSkill.skillDataInstance.damage; knockBack = belongSkill.skillDataInstance.knockForce; //bullet custom hit impact if (optionalEffectMethod != null) { DeleMethod = null; DeleMethod += optionalEffectMethod; } //specified hit effect, by default is the same as skill data hit effect if (specifiedHitEffect != null) { hitEffect = specifiedHitEffect; } else { hitEffect = belongSkill.ShowHitEffect(Vector3.zero, Quaternion.identity, false); } }
public void Init(SkillBehaviour thisSkill) { if (hasBeenSetup) { return; } belongedSkill = thisSkill; fireInterval = belongedSkill.skillDataInstance.optionalParams[1].value; fireTimer = 0f; barRotateSpeed = belongedSkill.skillDataInstance.optionalParams[2].value; chillyNum = (int)belongedSkill.skillDataInstance.optionalParams[0].value; float intervalAngle = 360f / chillyNum; for (int i = 0; i < chillyNum; i++) { dirs.Add(AngleToRayDir(intervalAngle * i)); } bulletPool.obj = belongedSkill.skillDataInstance.skillBullet; shootClip = belongedSkill.skillDataInstance.optionalClips[0].clip; hasBeenSetup = true; }
public void SetSkill(SkillBehaviour skillBehaviour, SkillButton skillButton) { currentSkillButton = skillButton; currentSkill = skillBehaviour; gameObject.SetActive(true); enabled = true; }
private void Reset(SkillBehaviour canceledSkill) { if (canceledSkill.Name == skill.Name) { buttonCooldown.Finish(); } }
private void OnDisable() { currentSkillButton = null; currentSkill = null; isFired = false; canBeCasted = false; }
private IEnumerator LookAt(SkillBehaviour skill, Transform target) { while (skill.gameObject.transform.parent != null) { skill.gameObject.transform.LookAt(target); yield return(null); } }
private void Update() { if (selectedSkill != null && (Input.GetKeyDown(KeyCode.Escape) || Input.GetMouseButtonDown(1))) { selectedSkill.OnDeselect(); selectedSkill = null; } }
private IEnumerator DelaySkill(SkillBehaviour skill, Transform target) { yield return(new WaitForSeconds(skill.CastTime)); skill.SmallEffect.SetActive(false); skill.gameObject.transform.parent = null; skill.SetDestination(target, parent); }
public virtual void Cast(GameObject skill, Transform target) { SkillBehaviour skillBehaviour = skill.GetComponent <SkillBehaviour>(); float multiplier = defaultCastSpeed / skillBehaviour.CastTime; parent.Stop(); baseAnim.SetFloat("castSpeed", multiplier); baseAnim.SetTrigger(AnimEnum.Attack); }
public void SelectSkill(SkillBehaviour skill) { if (selectedSkill != null) { selectedSkill.OnDeselect(); } selectedSkill = skill; skill.OnSelected(); }
public void Cast(GameObject skill, Transform target) { SkillBehaviour skillBehaviour = skill.GetComponent <SkillBehaviour>(); Sound.Instance.PlaySoundClipWithSource(skillBehaviour.CastSoundHolder, audioSource, skillBehaviour.CastTime); entityBehaviourClass.Cast(skill, target); casting = true; castCoroutine = ResetCasting(skillBehaviour.CastTime); StartCoroutine(castCoroutine); }
// Called from Canvas/SkillManager EventTrigger public void ShootSkill() { if (selectedSkill == null) { return; } selectedSkill.Shoot(CursorBehaviour.GetWorldPosition()); selectedSkill.OnDeselect(); selectedSkill = null; }
public void InitInstance(SkillBehaviour new_behaviour, CastInfo new_cast_info) { if (curr_behaviour == null && base_behaviour == null) { curr_behaviour = new_behaviour; base_behaviour = new_behaviour; cast_info = new_cast_info; cast_info.hitted_colliders = new List <Collider>(); } else { Debug.LogError("skillbehvaiour already initiated"); } }
public override void Cast(GameObject skill, Transform target) { base.Cast(skill, target); transform.LookAt(target); currentSkill = Instantiate(skill, skillRoot.transform.position, Quaternion.identity).GetComponent <SkillBehaviour>(); currentSkill.gameObject.transform.SetParent(skillRoot.transform, false); lookAtCoroutine = LookAt(currentSkill, target); StartCoroutine(lookAtCoroutine); currentSkill.gameObject.transform.position = skillRoot.transform.position; switchEffectCoroutine = SwitchEffect(currentSkill); StartCoroutine(switchEffectCoroutine); resetCastCoroutine = DelaySkill(currentSkill, target); StartCoroutine(resetCastCoroutine); }
private void Skill_OnSuccessUsed(ISkill skill, SkillContext context) { var animState = AnimationAttribute.GetAnimationState(skill); if (animState != null) { AnimationManagerBase.CreateOrGet(gameObject).SetState(animState.Value); } var audioSource = SkillBehaviour.GetAudioSource(skill); if (audioSource != null) { audioSource.Play(); } }
//Behaviour changes public void AddBehaviour(SkillBehaviour new_behaviour) { curr_behaviour += new_behaviour; }
private void CancelSkillEvent(SkillBehaviour canceledSkill) { OnCancelSkillEvent?.Invoke(canceledSkill); }
public void CancelSkill(SkillBehaviour canceledSkill) { CancelSkillEvent(canceledSkill); }
private IEnumerator SwitchEffect(SkillBehaviour skill) { yield return(new WaitForSeconds(skill.CastTime * 0.8f)); skill.BigEffect.SetActive(true); }
public void RemoveBehaviour(SkillBehaviour old_behaviour) { curr_behaviour -= old_behaviour; }
public void ReplaceBehaviour(SkillBehaviour new_behaviour) { curr_behaviour = new_behaviour; }
public void ResetBehaviour() { curr_behaviour = base_behaviour; }