Example #1
0
        private void AddEntityModelToMap(object sender, EntityArgs args)
        {
            GameObject entityPrefab   = entityController.GetEntityPrefab(args.entity);
            GameObject entityInstance = Instantiate(entityPrefab, m_CoordinateToTransform[args.coordinate]);

            entityInstance.GetComponent <EntityView>().Initialize(args.entity);
        }
Example #2
0
 private void EntityRemoveHandler(object sender, EntityArgs e)
 {
     if (e.Entity is LLPrimitive)
     {
         m_writeQueue.Add(e.Entity.ID, new PrimSerialization {
             ID = e.Entity.ID, Prim = null
         });
     }
 }
Example #3
0
        private MKT_Config GetConfig(EntityArgs args)
        {
            var config = args as MKT_Config;
            if (config == null)
            {
                throw new ArgumentOutOfRangeException();
            }

            return config;
        }
 private void OnEntityDestroyed(object sender, EntityArgs args)
 {
     if (entitySpriteDict.ContainsKey(args.entity))
     {
         MFSprite        sp    = entitySpriteDict[args.entity];
         MFMainGameLayer layer = MFLayer.GetLayer <MFMainGameLayer>();
         if (layer != null)
         {
             layer.RemoveSprite(sp);
         }
     }
 }
Example #5
0
        private void EntityRemoveHandler(object sender, EntityArgs e)
        {
            // Remove all entities with dynamics enabled from our dictionary
            if (e.Entity is IPhysical)
            {
                IPhysical physical = (IPhysical)e.Entity;

                if (!physical.DynamicsEnabled)
                {
                    m_activePhysicsEntities.Remove(physical.LocalID);
                }
            }
        }
        private void OnEntitySpawned(object sender, EntityArgs args)
        {
            MFQuadSprite    sp    = new MFQuadSprite();
            MFMainGameLayer layer = MFLayer.GetLayer <MFMainGameLayer>();

            if (args.entity is MFBullet)
            {
                sp.texName = "bullet";
            }
            else
            {
                sp.texName = "ship";
            }
            if (layer != null)
            {
                layer.AddSprite(sp);
            }
            this.entitySpriteDict[args.entity] = sp;
        }
Example #7
0
        /// <summary>
        /// Removes the follower and all followers of that follower. Use GetFollowersOfFollower before calling this to get them.
        /// </summary>
        public void RemoveFollower(object sender, EntityArgs args)
        {
            BetaBunny betaBunny;

            if (args.Entity is BetaBunny)
            {
                betaBunny = (BetaBunny)args.Entity;
            }
            else
            {
                return; // If this happens then it's 100% your fault.
            }
            if (followers.Count > 1)
            {
                int index = followers.IndexOf(betaBunny); // We use this as start index in iteration
                if (index == -1)
                {
                    return; //  Should not happen but happens anyway
                }
                var list = new List <BetaBunny>();
                for (int i = index; i < followers.Count; i++)
                {
                    followers[i].SetState(CmpAI_Follower.STATE_CmpAI_Follower.NoneToFollow);
                    followers[i].ai.entity_toFollow = null;
                    list.Add(followers[i]);
                }

                foreach (var bb in list)
                {
                    bb.ai.StoppedFollowing -= RemoveFollower;
                    followers.Remove(bb);
                }
            }
            else
            {
                betaBunny.ai.entity_toFollow = null;
                betaBunny.SetState(CmpAI_Follower.STATE_CmpAI_Follower.NoneToFollow);

                betaBunny.ai.StoppedFollowing -= RemoveFollower;
                followers.Remove(betaBunny);
            }
        }
 private void EntityRemoveHandler(object sender, EntityArgs e)
 {
     if (e.Entity is LLPrimitive)
         m_writeQueue.Add(e.Entity.ID, new PrimSerialization { ID = e.Entity.ID, Prim = null });
 }
Example #9
0
 public void Initializae(EntityArgs args)
 {
     _code = cromosomeCreator.EntityArgsToCode(args);
     Code = string.Join("", _code);
 }
Example #10
0
        private void EntityRemoveHandler(object sender, EntityArgs e)
        {
            // Remove all entities with dynamics enabled from our dictionary
            if (e.Entity is IPhysical)
            {
                IPhysical physical = (IPhysical)e.Entity;

                if (!physical.DynamicsEnabled)
                    m_activePhysicsEntities.Remove(physical.LocalID);
            }
        }
Example #11
0
        private void EntityRemoveHandler(object sender, EntityArgs e)
        {
            if (e.Entity is LLAgent && ((LLAgent)e.Entity).IsChildPresence)
                return;

            m_scene.CreateInterestListEvent(new InterestListEvent(e.Entity.ID, OBJECT_REMOVE, e.Entity.ScenePosition, e.Entity.Scale, e.Entity.LocalID));
        }
Example #12
0
 public float Value(EntityArgs args)
 {
     var config = GetConfig(args);
     return new MKT(config).Solve().Value;
 }
Example #13
0
        private void RemoveEntityModelFromMap(object sender, EntityArgs args)
        {
            Transform transform = m_CoordinateToTransform[args.coordinate];

            Destroy(transform.GetComponentInChildren <EntityView>().gameObject);
        }
Example #14
0
 public float Value(EntityArgs args)
 {
     var binaryArgs = args as BinaryEntityArgs;
     return GlobalSettings.Fn(binaryArgs.X, binaryArgs.Y);
 }
Example #15
0
 public int[] EntityArgsToCode(EntityArgs args)
 {
     var config = GetConfig(args);
     return config.ToArray();
 }