Ejemplo n.º 1
0
        private void UpdateToungueState(EntityRegistry registry)
        {
            int count = mAllToungues.Entity.Count;

            for (int i = 0; i < count; ++i)
            {
                ToungueState state   = mAllToungues.State[i];
                float        newTime = state.TimeLeft - mTime.DeltaTime;
                if (newTime > 0)
                {
                    state.TimeLeft = newTime;
                    registry.SetComponent(mAllToungues.Entity[i], state);
                }
                else
                {
                    int stateIndex = (int)state.Stage;
                    if (stateIndex > 0)
                    {
                        ToungueStages nextStage = (ToungueStages)(stateIndex - 1);
                        float         nextTime  = mData.GetStateTime(nextStage);
                        registry.SetComponent(mAllToungues.Entity[i], new ToungueState(nextStage, nextTime));
                    }
                    else
                    {
                        mTransitioning.Add(mAllToungues.Entity[i]);
                    }
                }
            }
            foreach (Entity toungue in mTransitioning)
            {
                Entity frog = registry.GetComponent <ParentEntity>(toungue).Parent;
                registry.RemoveComponent <ControlledEntity>(frog);
                registry.Destroy(toungue);
            }
            mTransitioning.Clear();
        }
Ejemplo n.º 2
0
 public ToungueState(ToungueStages stage, float timeLeft)
 {
     Stage    = stage;
     TimeLeft = timeLeft;
 }
Ejemplo n.º 3
0
 public float GetStateTime(ToungueStages state)
 {
     return(mStateTimes[(int)state]);
 }