// Start is called before the first frame update void Start() { Instance = this; AnimancerComponent.Animator.fireEvents = false; AnimancerComponent.States.CreateIfNew(IdleAnimation); AnimancerComponent.States.CreateIfNew(RunAnimation); AnimancerComponent.States.CreateIfNew(JumpAnimation); AnimancerComponent.States.CreateIfNew(AttackAnimation); AnimancerComponent.States.CreateIfNew(SkillAnimation); CombatEntity = EntityFactory.Create <CombatEntity>(); CombatEntity.AddComponent <SkillPreviewComponent>(); SkillConfigObject config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1001_黑火球术"); AbilityEntity abilityA = CombatEntity.AttachSkill <Skill1001Entity>(config); CombatEntity.BindAbilityInput(abilityA, KeyCode.Q); config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1002_炎爆"); abilityA = CombatEntity.AttachSkill <Skill1002Entity>(config); CombatEntity.BindAbilityInput(abilityA, KeyCode.W); config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1004_血红激光炮"); abilityA = CombatEntity.AttachSkill <Skill1004Ability>(config); CombatEntity.BindAbilityInput(abilityA, KeyCode.E); AnimTimer.MaxTime = AnimTime; }
public override void Cast() { Debug.Log("Cast is called"); //Set the timer if (GetTimer() == 0) { SetTimer(3); } //Play the animation //this.agentAnimator.Play(GetAnimationStateName()); //Make the player float. agent.GetComponent <ThirdPersonMovement>().SetPlayerGravity(false); //agent.GetComponent<ThirdPersonMovement>()._controller.Move(Vector3.up * 50 * Time.deltaTime); StartCoroutine(FloatPlayer(3, agent.GetComponent <ThirdPersonMovement>()._controller)); //Wait a certain number of seconds //Proceed to the next state of the ability //Generate left and right orb AbilityEntity entityOrbL = Instantiate(this.abilityEntitites[1], agent.transform.position, Quaternion.Euler(0, 0, 0)); AbilityEntity entityOrbR = Instantiate(this.abilityEntitites[2], agent.transform.position, Quaternion.Euler(0, 0, 0)); //Attach the orbs to the player so that it moves with the player entityOrbL.transform.parent = agent; entityOrbR.transform.parent = agent; //LOG Cast Debug.Log("SpecialAbility: " + this.GetAnimationStateName() + " is in casting state"); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { inputDeps.Complete(); var commands = new EntityCommandBuffer(Allocator.TempJob); var ownedAbilityBufferFromEntity = GetBufferFromEntity <AbilityOwner.OwnedAbility>(true); Entities .WithAll <AuthoringData>() .WithNone <AbilityEntity>() .ForEach((Entity entity, ref Part.Owner partOwner) => { var abilityEntity = Ability.FindAbility(ownedAbilityBufferFromEntity, partOwner.Value, AbilityMovement.Tag); if (abilityEntity == Entity.Null) { return; } var ability = new AbilityEntity { Value = abilityEntity }; commands.AddComponent(entity, ability); }).Run(); commands.Playback(EntityManager); commands.Dispose(); return(default);
public override async void BeginExecute() { base.BeginExecute(); var taskData = new CreateEffectTaskData(); taskData.Position = GetParent <CombatEntity>().Position; taskData.Direction = InputDirection; taskData.LifeTime = 2000; taskData.EffectPrefab = GetAbilityEntity <Skill1004Entity>().SkillConfigObject.SkillEffectObject; var task = EntityFactory.CreateWithParent <CreateEffectTask>(this, taskData); task.ExecuteTaskAsync().Coroutine(); await TimerComponent.Instance.WaitAsync(1000); var taskData2 = new CreateTriggerTaskData(); taskData2.Position = GetParent <CombatEntity>().Position; taskData2.Direction = InputDirection; taskData2.LifeTime = 200; taskData2.TriggerPrefab = GetAbilityEntity <Skill1004Entity>().SkillConfigObject.AreaCollider; var task2 = EntityFactory.CreateWithParent <CreateTriggerTask>(this, taskData2); task2.OnTriggerEnterCallbackAction = (other) => { AbilityEntity.ApplyAbilityEffect(other.GetComponent <Monster>().CombatEntity); }; await task2.ExecuteTaskAsync(); EndExecute(); }
public override void Action() { if (!triggerActionStateOnce) { Debug.Log("SpecialAbility: " + this.GetAnimationStateName() + " is in action state"); //Play the animation //Generate the Grappler entity AbilityEntity entity = Instantiate(this.abilityEntitites[0], agent.transform.position, agent.transform.rotation); //Attach the entity to the player so that it moves with the player entity.transform.parent = agent; entity.SetAgent(agent); //Ensure the grapple point looks at the center of the screen. Camera cam = GetAgent().GetComponent <ThirdPersonMovement>().cam.GetComponent <Camera>(); //entity.GetComponent<GrapplerAbilityEntity>().GrappleTip.LookAt(GetAgent().GetComponent<ThirdPersonMovement>().cam.GetComponent<Camera>().ScreenToWorldPoint(new Vector3(cam.pixelWidth/2, cam.pixelHeight/2, 0))); //Ensure the Grapple tip looks forward at the center of the screen entity.GetComponent <GrapplerAbilityEntity>().GrappleTip.LookAt(cam.transform.forward); //Ensure the ability entity is connected to the object the player's reticle is currently aiming at try { entity.GetComponent <GrapplerAbilityEntity>().ConnectedObject = agent.GetComponent <ThirdPersonMovement>().aimReticle.GetComponent <Reticle>().Target.transform; } catch (System.Exception) { Debug.Log("Reticle is not looking at a target: destroy this ability"); //Ensure the entity resets player controls entity.GetComponent <GrapplerAbilityEntity>().GetGrapple().ResetPlayer(); Destroy(entity.gameObject); Destroy(this.gameObject); } //Grab the Target that is connected to the grappler. This target is originally defined by the Reticle /*if(entity.GetComponent<GrapplerAbilityEntity>().ConnectedObject != null) * { * agent.GetComponent<ThirdPersonMovement>().EngageDynamicTargetLock(entity.GetComponent<GrapplerAbilityEntity>().ConnectedObject); * }*/ //Turn off character controller & Turn the rigid body on agent.GetComponent <ThirdPersonMovement>()._controller.enabled = false; agent.GetComponent <ThirdPersonMovement>().moveCharacter = false; agent.GetComponent <ThirdPersonMovement>().togglePlayerMovementControl(false); agent.GetComponent <ThirdPersonMovement>().applyGravity = false; agent.GetComponent <Rigidbody>().isKinematic = false; agent.GetComponent <RigidbodyCharacter>().enabled = true; //Proceed to the next animation ActivateActionStateOnce(); } }
public override async void BeginExecute() { base.BeginExecute(); var task = EntityFactory.CreateWithParent <CastProjectileAbilityTask>(this, InputPoint); await task.ExecuteTaskAsync(); AbilityEntity.ApplyAbilityEffect(InputCombatEntity); EndExecute(); }
public override async void BeginExecute() { base.BeginExecute(); var taskData = new CastProjectileTaskData(); taskData.ProjectilePrefab = (AbilityEntity as Skill1001Entity).SkillConfigObject.SkillEffectObject; var task = EntityFactory.CreateWithParent <CastProjectileAbilityTask>(this, taskData); await task.ExecuteTaskAsync(); AbilityEntity.ApplyAbilityEffect(InputCombatEntity); EndExecute(); }
public void Init(AbilityEntity abilityEntity) { // Debug.Log(gameObject.activeSelf); // Debug.Log (gameObject.activeInHierarchy); // Debug.Log (gameObject.transform.parent); // Debug.Log (name); _abilityEntity = abilityEntity; _abilityEntity.castCard.shell.battleController.shieldPanel.Activate(); transform.position = _abilityEntity.castCard.transform.position; Vector3 destination = abilityEntity.targetCard.transform.position; //Set animations playing position foreach (var item in _atTargetPosition) { Debug.Log(8); item.transform.position = destination; } foreach (var item in _hitEffect) { item.SetActive(false); Debug.Log(7); } foreach (var item in _moveToTarget) { item.transform.up = (_abilityEntity.targetCard.transform.position - item.transform.position).normalized; HOTween.To(item.transform, _flyTime, new TweenParms().Prop("position", _abilityEntity.targetCard.transform.position)); } //Set destination of hotweens which tween transform.position. // foreach (HOTweenComponent hotweenCom in _hotweenComArray) { // Debug.Log(hotweenCom.name); // Debug.Log(hotweenCom.tweenDatas==null); // hotweenCom.generatedTweeners; // foreach (HOTweenManager.HOTweenData hotweenData in hotweenCom.tweenDatas) { // if (hotweenData.targetName == "transform") { // foreach (HOTweenManager.HOPropData propData in hotweenData.propDatas) { // if (propData.propName == "position") { // propData.endValVector3 = destination; // } // } // } // } // } }
public override async void BeginExecute() { base.BeginExecute(); //OwnerEntity.Publish(new PlayAnimationTask()); //EntityFactory.CreateWithParent<PlayAnimationTask>(this, "施法动作").ExecuteTaskAsync().Coroutine(); var taskData = new CastProjectileTaskData(); taskData.ProjectilePrefab = (AbilityEntity as Skill1001Entity).SkillConfigObject.SkillEffectObject; var task = EntityFactory.CreateWithParent <CastProjectileTask>(this, taskData); await task.ExecuteTaskAsync(); AbilityEntity.ApplyAbilityEffectsTo(InputCombatEntity); EndExecute(); }
public override void Update() { if (Input.GetKeyDown(KeyCode.Q)) { UnityEngine.Cursor.visible = false; PreviewingAbility = GetEntity <CombatEntity>().InputAbilitys[KeyCode.Q]; EnterPreview(); } if (Input.GetMouseButtonDown((int)UnityEngine.UIElements.MouseButton.RightMouse)) { CancelPreview(); } if (Previewing) { TargetSelectManager.Instance.transform.position = Input.mousePosition; } }
public override void Action() { if (!triggerActionStateOnce) { Debug.Log("SpecialAbility: " + this.GetAnimationStateName() + " is in action state"); //Play the animation //Generate the dome that will surround Eston is this an abilityEntity? Something that spawns and has a hitbox? AbilityEntity entity = Instantiate(this.abilityEntitites[0], agent.transform.position, Quaternion.Euler(-90, 0, 0)); //Attach the dome to the player so that it moves with the player entity.transform.parent = agent; //Have the player affected by gravity again. agent.GetComponent <ThirdPersonMovement>().SetPlayerGravity(true); //Proceed to the next animation ActivateActionStateOnce(); } }
public override void Action() { if (!triggerActionStateOnce) { Debug.Log("SpecialAbility: " + this.GetAnimationStateName() + " is in action state"); //Play the animation //Generate the overskin AbilityEntity entity = Instantiate(this.abilityEntitites[0], agent.transform.position, agent.transform.rotation); //Set entity's agent property entity.SetAgent(this.agent); //Attach the overskin to the player so that it moves with the player entity.transform.parent = agent; //Have the player affected by gravity again. agent.GetComponent <ThirdPersonMovement>().SetPlayerGravity(true); //Proceed to the next animation ActivateActionStateOnce(); } }
protected override JobHandle OnUpdate(JobHandle inputDeps) { inputDeps.Complete(); var PostUpdateCommands = new EntityCommandBuffer(Allocator.TempJob); var OwnedAbilityBufferFromEntity = GetBufferFromEntity <AbilityOwner.OwnedAbility>(true); Entities.WithNativeDisableContainerSafetyRestriction(PostUpdateCommands) .WithAll <AutoringData>() .WithNone <AbilityEntity>() .WithoutBurst() .ForEach((Entity entity, ref Part.Owner partOwner) => { var rootOwner = EntityManager.GetComponentData <Item.InputState>(partOwner.Value).owner; if (rootOwner == Entity.Null) { return; } var abilityEntity = Ability.FindAbility(OwnedAbilityBufferFromEntity, rootOwner, AbilityAutoRifle.Tag); if (abilityEntity == Entity.Null) { return; } var ability = new AbilityEntity { Value = abilityEntity }; PostUpdateCommands.AddComponent(entity, ability); }).Run(); PostUpdateCommands.Playback(EntityManager); PostUpdateCommands.Dispose(); return(default);
public override async void BeginExecute() { base.BeginExecute(); var taskData2 = new CreateTriggerTaskData(); taskData2.Position = InputPoint; taskData2.TriggerPrefab = (AbilityEntity as Skill1002Entity).SkillConfigObject.AreaCollider; var task2 = EntityFactory.CreateWithParent <CreateTriggerTask>(this, taskData2); task2.OnTriggerEnterCallbackAction = (other) => { AbilityEntity.ApplyAbilityEffect(other.GetComponent <Monster>().CombatEntity); }; task2.ExecuteTaskAsync().Coroutine(); var taskData = new CreateExplosionTaskData(); taskData.TargetPoint = InputPoint; taskData.ExplosionPrefab = (AbilityEntity as Skill1002Entity).SkillConfigObject.SkillEffectObject; var task = EntityFactory.CreateWithParent <CreateExplosionTask>(this, taskData); await task.ExecuteTaskAsync(); EndExecute(); }
public override async void BeginExecute() { base.BeginExecute(); Hero.Instance.StopMove(); Hero.Instance.PlayThenIdleAsync(Hero.Instance.AnimationComponent.SkillAnimation).Coroutine(); Hero.Instance.SkillPlaying = true; Hero.Instance.transform.GetChild(0).eulerAngles = new Vector3(0, InputDirection, 0); var taskData = new CreateEffectTaskData(); taskData.Position = GetParent <CombatEntity>().Position; taskData.Direction = InputDirection; taskData.LifeTime = 2000; taskData.EffectPrefab = GetAbility <Skill1004Ability>().SkillConfigObject.SkillEffectObject; var task = EntityFactory.CreateWithParent <CreateEffectTask>(this, taskData); task.ExecuteTaskAsync().Coroutine(); await TimerComponent.Instance.WaitAsync(1500); var taskData2 = new CreateTriggerTaskData(); taskData2.Position = GetParent <CombatEntity>().Position; taskData2.Direction = InputDirection; taskData2.LifeTime = 200; taskData2.TriggerPrefab = GetAbility <Skill1004Ability>().SkillConfigObject.AreaCollider; taskData2.OnTriggerEnterCallback = (other) => { AbilityEntity.ApplyAbilityEffectsTo(other.GetComponent <Monster>().CombatEntity); }; var task2 = EntityFactory.CreateWithParent <CreateTriggerTask>(this, taskData2); await task2.ExecuteTaskAsync(); EndExecute(); Hero.Instance.SkillPlaying = false; }
public void AddSpawnedAbilityEntity(AbilityEntity abilityEntity) { this.spawnedAbilityEntities.Add(abilityEntity); }
public void BindAbilityInput(AbilityEntity abilityEntity, KeyCode keyCode) { InputAbilitys.Add(keyCode, abilityEntity); abilityEntity.TryActivateAbility(); }