Beispiel #1
0
        public Entity AddLastBlocked(Entitas.Entity newNode)
        {
            var component = CreateComponent <LastBlocked>(ComponentIds.LastBlocked);

            component.node = newNode;
            return(AddComponent(ComponentIds.LastBlocked, component));
        }
Beispiel #2
0
        public Entity AddStandOn(Entitas.Entity newNode)
        {
            var component = CreateComponent <StandOn>(ComponentIds.StandOn);

            component.node = newNode;
            return(AddComponent(ComponentIds.StandOn, component));
        }
Beispiel #3
0
        public void Update()
        {
            ReplayLogicFrameBehaviour replayLogic = Sim.GetBehaviour <ReplayLogicFrameBehaviour>();
            List <FrameIdxInfo>       list        = replayLogic.GetFrameIdxInfoAtCurrentFrame();

            if (list != null)
            {
                foreach (FrameIdxInfo info in list)
                {
                    switch (info.Cmd)
                    {
                    case FrameCommand.SYNC_MOVE:
                        Entitas.Entity ent = Sim.GetEntityWorld().GetEntity(info.EntityId);
                        if (ent != null)
                        {
                            ent.GetComponent <MoveComponent>().UpdateParams(info.Params);
                            //Debug.Log(string.Format("EntityId: {0} Dir:{1} {2} ", info.EntityId, float.Parse(info.Params[0]), float.Parse(info.Params[1])));
                        }
                        break;

                    case FrameCommand.SYNC_CREATE_ENTITY:
                        Sim.GetEntityWorld().NotifyCreateEntity(info);
                        break;
                    }
                }
            }
        }
Beispiel #4
0
        public Entity AddShield(Entitas.Entity newOwner)
        {
            var component = _shieldComponentPool.Count > 0 ? _shieldComponentPool.Pop() : new ShieldComponent();

            component.owner = newOwner;
            return(AddComponent(ComponentIds.Shield, component));
        }
        public Entity AddGoal(Entitas.Entity newNode)
        {
            var component = CreateComponent <Goal>(ComponentIds.Goal);

            component.node = newNode;
            return(AddComponent(ComponentIds.Goal, component));
        }
Beispiel #6
0
 public void Apply(Entitas.Entity entity)
 {
     foreach (var component in m_components)
     {
         component.Apply(entity);
     }
 }
        public Entity AddMoveTo(Entitas.Entity newNode)
        {
            var component = CreateComponent <MoveTo>(ComponentIds.MoveTo);

            component.node = newNode;
            return(AddComponent(ComponentIds.MoveTo, component));
        }
Beispiel #8
0
        public Entity AddFollowTarget(Entitas.Entity newTarget)
        {
            var component = _followTargetComponentPool.Count > 0 ? _followTargetComponentPool.Pop() : new FollowTargetComponent();

            component.target = newTarget;
            return(AddComponent(ComponentIds.FollowTarget, component));
        }
        public Entity AddChild(Entitas.Entity newParent)
        {
            var component = _childComponentPool.Count > 0 ? _childComponentPool.Pop() : new ChildComponent();

            component.parent = newParent;
            return(AddComponent(ComponentIds.Child, component));
        }
Beispiel #10
0
        public Entity AddCameFrom(Entitas.Entity newOrigin)
        {
            var component = CreateComponent <CameFrom>(ComponentIds.CameFrom);

            component.origin = newOrigin;
            return(AddComponent(ComponentIds.CameFrom, component));
        }
    public void ReplaceTouch(Entitas.Entity newEntity)
    {
        var index     = InputComponentsLookup.Touch;
        var component = (TouchComponent)CreateComponent(index, typeof(TouchComponent));

        component.entity = newEntity;
        ReplaceComponent(index, component);
    }
        public Entity ReplaceGoal(Entitas.Entity newNode)
        {
            var component = CreateComponent <Goal>(ComponentIds.Goal);

            component.node = newNode;
            ReplaceComponent(ComponentIds.Goal, component);
            return(this);
        }
        public Entity ReplaceMoveTo(Entitas.Entity newNode)
        {
            var component = CreateComponent <MoveTo>(ComponentIds.MoveTo);

            component.node = newNode;
            ReplaceComponent(ComponentIds.MoveTo, component);
            return(this);
        }
Beispiel #14
0
        public Entity ReplaceLastBlocked(Entitas.Entity newNode)
        {
            var component = CreateComponent <LastBlocked>(ComponentIds.LastBlocked);

            component.node = newNode;
            ReplaceComponent(ComponentIds.LastBlocked, component);
            return(this);
        }
Beispiel #15
0
        public Entity ReplaceCameFrom(Entitas.Entity newOrigin)
        {
            var component = CreateComponent <CameFrom>(ComponentIds.CameFrom);

            component.origin = newOrigin;
            ReplaceComponent(ComponentIds.CameFrom, component);
            return(this);
        }
Beispiel #16
0
        public Entity ReplaceStandOn(Entitas.Entity newNode)
        {
            var component = CreateComponent <StandOn>(ComponentIds.StandOn);

            component.node = newNode;
            ReplaceComponent(ComponentIds.StandOn, component);
            return(this);
        }
Beispiel #17
0
        public Entity AddLaser(float newHeight, UnityEngine.Vector2 newDirection, Entitas.Entity newSource)
        {
            var component = _laserComponentPool.Count > 0 ? _laserComponentPool.Pop() : new LaserComponent();

            component.height    = newHeight;
            component.direction = newDirection;
            component.source    = newSource;
            return(AddComponent(ComponentIds.Laser, component));
        }
Beispiel #18
0
    public void ReplaceCollision(Entitas.Entity newSelf, Entitas.Entity newOther)
    {
        var index     = InputComponentsLookup.Collision;
        var component = (CollisionComponent)CreateComponent(index, typeof(CollisionComponent));

        component.self  = newSelf;
        component.other = newOther;
        ReplaceComponent(index, component);
    }
Beispiel #19
0
        public Entity AddRequest(Entitas.Entity newStart, Entitas.Entity newTarget)
        {
            var componentPool = GetComponentPool(ComponentIds.Request);
            var component     = (RequestComponent)(componentPool.Count > 0 ? componentPool.Pop() : new RequestComponent());

            component.start  = newStart;
            component.target = newTarget;
            return(AddComponent(ComponentIds.Request, component));
        }
    public void ReplaceAttack(Entitas.Entity newSource, Vector3f newDirection)
    {
        var index     = InputComponentsLookup.Attack;
        var component = CreateComponent <AttackComponent>(index);

        component.Source    = newSource;
        component.Direction = newDirection;
        ReplaceComponent(index, component);
    }
Beispiel #21
0
        public Entity AddAI(Entitas.Entity newTargetEntity, float newDeadZoneY, float newVelocityY)
        {
            var component = CreateComponent <RMC.EntitasPong.Entitas.Components.AIComponent>(ComponentIds.AI);

            component.targetEntity = newTargetEntity;
            component.deadZoneY    = newDeadZoneY;
            component.velocityY    = newVelocityY;
            return(AddComponent(ComponentIds.AI, component));
        }
Beispiel #22
0
        public Entity ReplaceAI(Entitas.Entity newTargetEntity, float newDeadZoneY, float newVelocityY)
        {
            var component = CreateComponent <Oultrox.EntitasPong.Entitas.Components.AIComponent>(ComponentIds.AI);

            component.targetEntity = newTargetEntity;
            component.deadZoneY    = newDeadZoneY;
            component.velocityY    = newVelocityY;
            ReplaceComponent(ComponentIds.AI, component);
            return(this);
        }
Beispiel #23
0
        protected override void OnRender(Entitas.Entity entity)
        {
            base.OnRender(entity);
            FrameClockComponent com = entity.GetComponent <FrameClockComponent>();

            if (com != null)
            {
                m_Rate = com.GetRate();
            }
        }
Beispiel #24
0
        protected override void OnRender(Entitas.Entity entity)
        {
            base.OnRender(entity);

            PlayerInfoComponent com = entity.GetComponent <PlayerInfoComponent>();

            if (com != null)
            {
                m_Txt.text = com.Value.ToString();
            }
        }
Beispiel #25
0
        public Entity AddNode(Entitas.Entity newParent, float newFcost, float newGcost, float newHcost)
        {
            var componentPool = GetComponentPool(ComponentIds.Node);
            var component     = (NodeComponent)(componentPool.Count > 0 ? componentPool.Pop() : new NodeComponent());

            component.parent = newParent;
            component.fcost  = newFcost;
            component.gcost  = newGcost;
            component.hcost  = newHcost;
            return(AddComponent(ComponentIds.Node, component));
        }
Beispiel #26
0
        public Entity SetLastBlocked(Entitas.Entity newNode)
        {
            if (hasLastBlocked)
            {
                throw new EntitasException("Could not set lastBlocked!\n" + this + " already has an entity with LastBlocked!",
                                           "You should check if the pool already has a lastBlockedEntity before setting it or use pool.ReplaceLastBlocked().");
            }
            var entity = CreateEntity();

            entity.AddLastBlocked(newNode);
            return(entity);
        }
Beispiel #27
0
        public Entity ReplaceFollowTarget(Entitas.Entity newTarget)
        {
            var previousComponent = hasFollowTarget ? followTarget : null;
            var component         = _followTargetComponentPool.Count > 0 ? _followTargetComponentPool.Pop() : new FollowTargetComponent();

            component.target = newTarget;
            ReplaceComponent(ComponentIds.FollowTarget, component);
            if (previousComponent != null)
            {
                _followTargetComponentPool.Push(previousComponent);
            }
            return(this);
        }
Beispiel #28
0
        public Entity ReplaceShield(Entitas.Entity newOwner)
        {
            var previousComponent = hasShield ? shield : null;
            var component         = _shieldComponentPool.Count > 0 ? _shieldComponentPool.Pop() : new ShieldComponent();

            component.owner = newOwner;
            ReplaceComponent(ComponentIds.Shield, component);
            if (previousComponent != null)
            {
                _shieldComponentPool.Push(previousComponent);
            }
            return(this);
        }
        public Entity ReplaceChild(Entitas.Entity newParent)
        {
            var previousComponent = hasChild ? child : null;
            var component         = _childComponentPool.Count > 0 ? _childComponentPool.Pop() : new ChildComponent();

            component.parent = newParent;
            ReplaceComponent(ComponentIds.Child, component);
            if (previousComponent != null)
            {
                _childComponentPool.Push(previousComponent);
            }
            return(this);
        }
Beispiel #30
0
        public Entity ReplaceLastBlocked(Entitas.Entity newNode)
        {
            var entity = lastBlockedEntity;

            if (entity == null)
            {
                entity = SetLastBlocked(newNode);
            }
            else
            {
                entity.ReplaceLastBlocked(newNode);
            }

            return(entity);
        }