Пример #1
0
        /// <summary>
        /// returns the pokemon's camera offset
        /// </summary>
        /// <param name="pokemonName"></param>
        /// <param name="entity"></param>
        /// <param name="entityManager"></param>
        public static void SetPokemonCameraData(ByteString30 pokemonName, Entity entity, EntityManager entityManager)
        {
            PokemonCameraData pcd = new PokemonCameraData {
                thridPersonOffset = new float3(0, 5f, -10f),
                firstPersonOffset = new float3(0, 2f, 0f)
            };

            switch (pokemonName.ToString())
            {
            case "Bulbasaur":
                break;

            case "Ivysaur":
                break;

            case "Venasaur":
                break;

            case "Electrode":
                pcd = new PokemonCameraData
                {
                    thridPersonOffset = new float3(0, 2f, 3.5f),
                    firstPersonOffset = new float3(0, 0.3f, -0.35f)
                };
                break;

            case "Cubone":
                pcd = new PokemonCameraData {
                    firstPersonOffset = new float3(0, 0.3f, -0.35f),
                    thridPersonOffset = new float3(0, 1f, -3f)
                };
                break;

            default:
                Debug.LogError("Failed to get pokemonCameraData!");
                break;
            }
            if (entityManager.HasComponent <PokemonCameraData>(entity))
            {
                entityManager.SetComponentData <PokemonCameraData>(entity, pcd);
            }
            else
            {
                entityManager.AddComponentData(entity, pcd);
            }
        }
Пример #2
0
        public static bool SetPhysicsDamping(EntityManager entityManager, Entity entity, ByteString30 name, PokemonEntityData ped)
        {
            PhysicsDamping ps = new PhysicsDamping
            {
                Angular = 0.05f,
                Linear  = 0.01f
            };

            switch (name.ToString())
            {
            case "Electrode":
                ps = new PhysicsDamping
                {
                    Angular = 0.5f,
                    Linear  = 0.1f
                };
                break;

            default: Debug.LogError("failed to find PhysicsDamping for pokemon \"" + name + "\""); break;
            }
            try
            {
                if (entityManager.HasComponent <PhysicsDamping>(entity))
                {
                    entityManager.SetComponentData <PhysicsDamping>(entity, ps);
                }
                else
                {
                    entityManager.AddComponentData(entity, ps);
                }
                return(true);
            }
            catch
            {
                Debug.LogError("Failed to set AngularDamping!");
            }
            return(false);
        }
Пример #3
0
        /*public void setMoveEntityData(Entity moveEntity, Entity mEntity, PokemonMove pokemonMove,
         *                      PokemonEntityData pmd, EntityManager entityManager, PlayerInput pi)
         *              {
         *                      PokemonMoveDataSpawn pmds = Core.Spawning.PokemonMoveSpawn.getPokemonMoveDataSpawn(entityManager,
         *                              pokemonMove.name, mEntity, pmd);
         *                      Debug.Log("Spawning "+ (pokemonMove.name) + pokemonMove.index);
         *                      entityManager.SetName(moveEntity, (pokemonMove.name) + pokemonMove.index);
         *                      entityManager.SetSharedComponentData(moveEntity, renderMeshDefault);
         *                      entityManager.SetComponentData(moveEntity, pmds.translation);
         *                      entityManager.SetComponentData(moveEntity, pmds.rotation);
         *                      entityManager.SetComponentData(moveEntity, GetPokemonMoveDataEntity(pokemonMove.name, pmd, pi.forward));
         *                      if (pmds.hasCollider) entityManager.SetComponentData(moveEntity, pmds.physicsCollider);
         *                      if (pmds.hasPhysicsVelocity) entityManager.SetComponentData(moveEntity, pmds.physicsVelocity);
         *                      if (pmds.hasMass) entityManager.AddComponentData(moveEntity, pmds.physicsMass);
         *                      if (pmds.hasDamping) entityManager.AddComponentData(moveEntity, pmds.physicsDamping);
         *                      if (pmds.hasGravityFactor) entityManager.AddComponentData(moveEntity, pmds.physicsGravityFactor);
         *                      if (pmds.hasParticles)
         *                      {
         *                              entityManager.AddComponentData(moveEntity, new ParticleSystemRequest { });
         *                              entityManager.AddComponentData(moveEntity, new ParticleSystemData { });
         *                              ParticleSystemSpawnData pssd = PokemonMoves.getPokemonMoveParticleSystemData(pmd.PokedexNumber,(pokemonMove.name));
         *                              if (pssd.isValid)
         *                              {
         *                                      Debug.Log("detected particleSystemspawn data");
         *                                      entityManager.AddComponentData(moveEntity, pssd);
         *                              }
         *                      }
         *                      if (pmds.hasEntity)
         *                      {
         *                              EntityManager.SetComponentData(moveEntity, new EntityParent {isValid = true,entity = pokemonMove.entity });
         *                              EntityManager.AddComponentData(mEntity, new EntityChild { isValid = true, entity = moveEntity });
         *                              EntityManager.AddComponentData(mEntity, GetPokemonMoveDataEntity(pokemonMove.name, pmd, pi.forward));
         *                      }
         *              }*/
        public static PokemonMoveDataEntity GetPokemonMoveDataEntity(ByteString30 name, PokemonEntityData ped, float3 forward)
        {
            PokemonMoveDataEntity pmde = new PokemonMoveDataEntity {
            };

            switch (name.ToString())
            {
            case "Tackle":
                pmde = new PokemonMoveDataEntity
                {
                    name        = name,
                    accuracy    = 1f,
                    attackType  = PokemonMoves.AttackType.normal,
                    damage      = calculateDamage(ped.currentLevel, 40f),
                    statusType  = PokemonMoves.StatusType.none,
                    contactType = PokemonMoves.ContactType.Physical,
                    isValid     = true,
                    pokemonMoveAdjustmentData = new PokemonMoveAdjustmentData
                    {
                        isValid = true,
                        pokemonMoveVelocitySet = new PokemonMoveVelocitySet
                        {
                            value = new PokemonMoveAdjustmentSet
                            {
                                A = new PokemonMoveAdjustment
                                {
                                    value = new float3 {
                                        x = ped.Speed, y = 0f, z = ped.Speed
                                    },
                                    timeLength         = -1f,
                                    useCameraDirection = true,
                                    staminaCost        = 5f
                                },
                                isValid = true
                            }
                        }
                    },
                    forward          = forward,
                    hasParticles     = true,
                    preformActionsOn = true
                };
                break;

            case "ThunderBolt":
                pmde = new PokemonMoveDataEntity
                {
                    attackType  = PokemonMoves.AttackType.electric,
                    contactType = PokemonMoves.ContactType.Special,
                    name        = name,
                    isValid     = true,
                    statusType  = PokemonMoves.StatusType.none,
                    accuracy    = 1f,
                    damage      = calculateDamage(ped.currentLevel, 40f),
                    pokemonMoveAdjustmentData = new PokemonMoveAdjustmentData
                    {
                        isValid = true,
                        pokemonMoveVelocitySet = new PokemonMoveVelocitySet
                        {
                            value = new PokemonMoveAdjustmentSet
                            {
                                isValid = true,
                                A       = new PokemonMoveAdjustment
                                {
                                    timeLength = 1f,
                                    value      = new float3 {
                                        x = 50f, y = 1f, z = 50f
                                    },
                                    useCameraDirection = true,
                                },
                                B = new PokemonMoveAdjustment
                                {
                                    timeLength = 0.5f,
                                    value      = new float3 {
                                        x = 0, y = 100f, z = 0
                                    },
                                    useCameraDirection = false
                                },
                                C = new PokemonMoveAdjustment
                                {
                                    timeLength = 0.1f,
                                    value      = new float3 {
                                        x = 0, y = -1000f, z = 0
                                    },
                                    useCameraDirection = false
                                }
                            }
                        }
                    },
                    forward          = forward,
                    hasParticles     = true,
                    preformActionsOn = true
                };
                break;

            default:
                Debug.LogError("failed to find a matching pokemon move data entity");
                break;
            }
            return(pmde);
        }