Exemplo n.º 1
0
    public override void Deactivate()
    {
        //Debug.Log(string.Format("Deactivating Cell ({0} x {1}) from State {2}", X, Y, currentState));

        // Update the state
        currentState = deactivateState;
    }
Exemplo n.º 2
0
    public override void Deactivate()
    {
        // Make sure the cell isn't deactivated already
        if (currentState == IGridCell.State.Active)
        {
            timeLastDeactivated = Time.time;
        }

        // Update the state
        currentState = IGridCell.State.InactivePersist;
    }
Exemplo n.º 3
0
    public override void Activate()
    {
        // Check if this cell is new
        if (currentState == IGridCell.State.InactiveNew)
        {
            // FIXME: for testing purposes, spawning objects at a random location
            IEnemy     objectToSpawn = null;
            IEnemyInfo newInfo       = null;
            for (int index = 0; index < numObjectsToSpawn; ++index)
            {
                // Get a random object
                objectToSpawn = null;
                if (spawnObjects.Length > 0)
                {
                    objectToSpawn = spawnObjects[Random.Range(0, spawnObjects.Length)];
                }

                // Check if there's an object to spawn
                if (objectToSpawn != null)
                {
                    // Grab a random location
                    Vector3 cloneLocation = Position;
                    cloneLocation.x = Random.Range(CellRange.xMin, CellRange.xMax);
                    cloneLocation.y = Random.Range(CellRange.yMin, CellRange.yMax);

                    // Grab a random rotation
                    Quaternion cloneRotation = Quaternion.Euler(0, 0, (Random.value * 360f));

                    // Generate a new enemy information
                    newInfo = objectToSpawn.GenerateNewInfo(cloneLocation, cloneRotation);
                    if (newInfo != null)
                    {
                        // Add this enemy information to the information set
                        EnemyInformationSet.Add(newInfo);
                    }
                }
            }
        }

        // Update the state
        currentState = IGridCell.State.Active;
    }
Exemplo n.º 4
0
    public override void Activate()
    {
        //Debug.Log(string.Format("Activating Cell ({0} x {1}) from State {2}", X, Y, currentState));

        // Check if this cell is new
        if (currentState == IGridCell.State.InactiveNew)
        {
            // Check if there's an object to spawn
            if (spawnObject != null)
            {
                // Generate a new enemy information
                IEnemyInfo newInfo = spawnObject.GenerateNewInfo(Position, Quaternion.identity);
                if (newInfo != null)
                {
                    // Add this enemy information to the information set
                    EnemyInformationSet.Add(newInfo);
                }
            }
        }

        // Update the state
        CellObject.SetActive(true);
        currentState = IGridCell.State.Active;
    }
Exemplo n.º 5
0
 public override void Activated(PoolingManager manager)
 {
     base.Activated(manager);
     currentState = IGridCell.State.InactiveNew;
 }
Exemplo n.º 6
0
 public override void Deactivate()
 {
     // Update the state
     currentState = IGridCell.State.InactiveExpired;
 }
Exemplo n.º 7
0
 public override void Activate()
 {
     // Update the state
     currentState = IGridCell.State.Active;
 }
Exemplo n.º 8
0
 public override void Initialized(PoolingManager manager)
 {
     base.Initialized(manager);
     currentState = IGridCell.State.InactivePersist;
 }
Exemplo n.º 9
0
 public override void Activated(PoolingManager manager)
 {
     base.Activated(manager);
     currentState = IGridCell.State.InactiveNew;
     //Debug.Log("Activated() called");
 }