Terrarium.Game.WorldState.RefreshOrganism C# (CSharp) Method

RefreshOrganism() public method

Should only be called by the game engine. Should be called if the state of the organism changes.
public RefreshOrganism ( OrganismBase.OrganismState state ) : void
state OrganismBase.OrganismState The state of the organism to refresh.
return void
        public void RefreshOrganism(OrganismState state)
        {
            if (IsImmutable)
            {
                throw new ApplicationException("WorldState must be mutable to change.");
            }

            var organismID = state.ID;

            // Clear the index if it's built
            if (IndexBuilt)
            {
                var oldState = GetOrganismState(organismID);
                FillCells(oldState, oldState.GridX, oldState.GridY, oldState.CellRadius, true);
            }

            _organisms.Remove(organismID);
            AddOrganism(state);
        }