Esempio n. 1
0
        void StopEnemyOnDeath(int targetID)
        {
            EnemyEntityView entityView = entityViewsDB.QueryEntityView <EnemyEntityView>(targetID);

            entityView.movementComponent.navMeshEnabled      = false;
            entityView.movementComponent.setCapsuleAsTrigger = true;
            entityView.rigidBodyComponent.isKinematic        = true;
        }
        IEnumerator Sink(EnemyEntityView entity, float sinkSpeed)
        {
            DateTime afterTwoSec = DateTime.UtcNow.AddSeconds(2);

            while (DateTime.UtcNow < afterTwoSec)
            {
                entity.transformComponent.position =
                    entity.positionComponent.position + -UnityEngine.Vector3.up * sinkSpeed * _time.deltaTime;

                yield return(null);
            }

            entity.destroyComponent.destroyed.value = true;
        }
Esempio n. 3
0
        IEnumerator Sink(EnemyEntityView entity)
        {
            DateTime afterTwoSec = DateTime.UtcNow.AddSeconds(2);

            while (DateTime.UtcNow < afterTwoSec)
            {
                entity.transformComponent.position =
                    entity.positionComponent.position + -UnityEngine.Vector3.up * entity.sinkSpeedComponent.sinkAnimSpeed * _time.deltaTime;

                yield return(null);
            }

            //we need to wait until the animation is finished
            //before to destroy the gameobject!
            entity.destroyComponent.mustDestroy.value = true;
        }
Esempio n. 4
0
        IEnumerator ModifyMovementSpeed(EnemyMovementInfo info)
        {
            int             targetId   = info.entityID;
            EnemyEntityView entityView = null;

            // I dont feel like this is a good solution, but I'm not sure how else I can know when the entities have
            // finnished building.
            while (entityView == null)
            {
                yield return(null);

                entityViewsDB.TryQueryEntityView(targetId, out entityView);
            }

            entityView.movementComponent.moveSpeed += info.movementSpeed;
        }