Exemple #1
0
 private void SpawnCollider(ColliderSpawnEmitter colliderSpawnEmitter)
 {
     if (colliderSpawnEmitter.ColliderType == ColliderType.TargetFly)
     {
         var taskData = new CastTargetFlyProjectileTaskData();
         taskData.FlyTime      = 0.3f;
         taskData.TargetEntity = InputTarget;
         var prefab = SkillExecutionAsset.transform.Find(colliderSpawnEmitter.ColliderName);
         taskData.ProjectilePrefab = prefab.gameObject;
         var task = Entity.CreateWithParent <CastTargetFlyProjectileTask>(OwnerEntity, taskData);
         task.OnEnterCallback = () => { AbilityEntity.ApplyAbilityEffectsTo(InputTarget); };
         task.ExecuteTaskAsync().Coroutine();
     }
     if (colliderSpawnEmitter.ColliderType == ColliderType.ForwardFly)
     {
         var taskData = new CastDirectFlyProjectileTaskData();
         var prefab   = SkillExecutionAsset.transform.Find(colliderSpawnEmitter.ColliderName);
         //var prefab = GetChildByName(SkillExecutionAsset.transform, colliderSpawnEmitter.ColliderName);
         taskData.ProjectilePrefab = prefab.gameObject;
         taskData.DirectAngle      = InputDirection;
         var task = Entity.CreateWithParent <CastDirectFlyProjectileTask>(OwnerEntity, taskData);
         task.OnCollisionCallback = (other) => {
             var combatEntity = CombatContext.Instance.GameObject2Entitys[other.gameObject];
             AbilityEntity.ApplyAbilityEffectsTo(combatEntity);
             GameObject.Destroy(task.Projectile);
             Entity.Destroy(task);
         };
         task.AddComponent <UpdateComponent>();
         task.ExecuteTaskAsync().Coroutine();
     }
     if (colliderSpawnEmitter.ColliderType == ColliderType.FixedPosition)
     {
         var taskData = new CreateColliderTaskData();
         taskData.Position = InputPoint;
         var prefab = SkillExecutionAsset.transform.Find(colliderSpawnEmitter.ColliderName);
         taskData.ColliderPrefab         = prefab.gameObject;
         taskData.LifeTime               = (int)(colliderSpawnEmitter.ExistTime * 1000);
         taskData.OnTriggerEnterCallback = (other) => {
             var combatEntity = CombatContext.Instance.GameObject2Entitys[other.gameObject];
             AbilityEntity.ApplyAbilityEffectsTo(combatEntity);
         };
         var task = Entity.CreateWithParent <CreateColliderTask>(this, taskData);
         task.ExecuteTaskAsync().Coroutine();
     }
     if (colliderSpawnEmitter.ColliderType == ColliderType.FixedDirection)
     {
         var taskData = new CreateColliderTaskData();
         taskData.Position  = OwnerEntity.Position;
         taskData.Direction = OwnerEntity.Direction;
         var prefab = SkillExecutionAsset.transform.Find(colliderSpawnEmitter.ColliderName);
         taskData.ColliderPrefab         = prefab.gameObject;
         taskData.LifeTime               = (int)(colliderSpawnEmitter.ExistTime * 1000);
         taskData.OnTriggerEnterCallback = (other) => {
             var combatEntity = CombatContext.Instance.GameObject2Entitys[other.gameObject];
             AbilityEntity.ApplyAbilityEffectsTo(combatEntity);
         };
         var task = Entity.CreateWithParent <CreateColliderTask>(this, taskData);
         task.ExecuteTaskAsync().Coroutine();
     }
 }
Exemple #2
0
 private void SpawnCollider(ColliderSpawnEmitter colliderSpawnEmitter)
 {
     if (colliderSpawnEmitter.ColliderType == ColliderType.TargetFly)
     {
         var taskData = new CastProjectileTaskData();
         taskData.FlyTime      = 0.3f;
         taskData.TargetEntity = InputCombatEntity;
         var prefab = SkillExecutionAsset.transform.Find(colliderSpawnEmitter.ColliderName);
         taskData.ProjectilePrefab = prefab.gameObject;
         var task = Entity.CreateWithParent <CastProjectileTask>(OwnerEntity, taskData);
         task.OnEnterCallback = () => { AbilityEntity.ApplyAbilityEffectsTo(InputCombatEntity); };
         task.ExecuteTaskAsync().Coroutine();
     }
     if (colliderSpawnEmitter.ColliderType == ColliderType.FixedPosition)
     {
         var taskData = new CreateColliderTaskData();
         taskData.Position = InputPoint;
         var prefab = SkillExecutionAsset.transform.Find(colliderSpawnEmitter.ColliderName);
         taskData.ColliderPrefab         = prefab.gameObject;
         taskData.LifeTime               = (int)(colliderSpawnEmitter.ExistTime * 1000);
         taskData.OnTriggerEnterCallback = (other) => { AbilityEntity.ApplyAbilityEffectsTo(other.GetComponent <Monster>().CombatEntity); };
         var task = Entity.CreateWithParent <CreateColliderTask>(this, taskData);
         task.ExecuteTaskAsync().Coroutine();
     }
     if (colliderSpawnEmitter.ColliderType == ColliderType.FixedDirection)
     {
         var taskData = new CreateColliderTaskData();
         taskData.Position  = OwnerEntity.Position;
         taskData.Direction = OwnerEntity.Direction;
         var prefab = SkillExecutionAsset.transform.Find(colliderSpawnEmitter.ColliderName);
         //var prefab = GetChildByName(SkillExecutionAsset.transform, colliderSpawnEmitter.ColliderName);
         taskData.ColliderPrefab         = prefab.gameObject;
         taskData.LifeTime               = (int)(colliderSpawnEmitter.ExistTime * 1000);
         taskData.OnTriggerEnterCallback = (other) => { AbilityEntity.ApplyAbilityEffectsTo(other.GetComponent <Monster>().CombatEntity); };
         var task = Entity.CreateWithParent <CreateColliderTask>(this, taskData);
         task.ExecuteTaskAsync().Coroutine();
     }
 }