示例#1
0
    public EnemyAgent SpawnEnemyCharacter(PlayInfo playInfo, int nodeIndex)
    {
        EnemyAgent enemyAgent = GameObject.Instantiate(Resources.Load <GameObject>("Prefab/Game/Enemy")).GetComponent <EnemyAgent>();
        Node       node       = battleScene.Nodes[nodeIndex];

        object[] myObjArray = { node };
        enemyAgent.transform.position = node.transform.position;
        enemyAgent.transform.rotation = node.transform.rotation;

        enemyAgent.Initialize(playInfo.monster.Id, myObjArray);
        enemyAgent.removed += DecrementNumberOfEnemies;

        participants.Add(enemyAgent);
        return(null);
    }
示例#2
0
    /// <summary>
    /// Spawn in the specified position and destination.
    /// </summary>
    /// <param name="position">Position.</param>
    /// <param name="destination">Destination.</param>
    private void Spawn(Transform position, Transform destination)
    {
        GameObject obj = Instantiate(Resources.Load <GameObject>("Prefab/Game/Enemy"));

        obj.transform.position = position.position;
        obj.transform.rotation = position.rotation;
        obj.transform.SetParent(destination);
        //obj.GetComponent<AiStateMove>().destination = destination;

        EnemyAgent enemyAgent = obj.GetComponent <EnemyAgent>();

        enemyAgent.Initialize(defenderId);

        obj.GetComponent <LevelAgent>().removed += UnitDie;
        // Add spawned object to buffer
        defendersList.Add(obj, destination);
    }