Exemple #1
0
    /// <summary>
    /// Creates an enemy for the spirit side of the battlefield.
    /// </summary>
    /// <param name="values"></param>
    /// <param name="group"></param>
    /// <param name="index"></param>
    private void CreateS(EnemyEntry values, EnemyGroup group)
    {
        if (!spawnTop)
        {
            return;
        }
        ggobjS = Instantiate(values.enemyModelS) as Transform;
        int side = Random.Range(0, 2);
        SStateController    state  = ggobjS.GetComponent <SStateController>();
        HurtableEnemyScript hurt   = ggobjS.GetComponent <HurtableEnemyScript>();
        AttackScript        attack = ggobjS.GetComponent <AttackScript>();

        if (side == 0)
        {
            state.leftSide = true;
        }

        ggobjS.position = state.GetRandomLocation();

        hurt.group = group;

        state.enemyid = enemyId;
        state.values  = ScriptableObject.CreateInstance <EnemyEntry>();
        state.values.CopyValues(values);

        group.top = hurt;
        group.sStateController = state;
        group.sTransform       = ggobjS;
        group.sAttackScript    = attack;
    }
Exemple #2
0
    private void Move(StateController controller)
    {
        SStateController scon = (SStateController)controller;

        scon.thisTransform.position = scon.GetRandomLocation();
        scon.startPosition          = scon.thisTransform.position;
    }