Example #1
0
    // Use this for initialization
    void Start()
    {
        if (windowTell == null)
        {
            Debug.LogWarning("I NEED A WINDOW OF OPPORTUNITY EFFECT IN Window Tell PLS KTHX");
        }
        player = GameObject.FindGameObjectWithTag("Player");
        agent  = GetComponent <NavMeshAgent>();
        puppet = GetComponent <PuppetScript>();
        FindMonitor();
        nextAction = 1;
        actions    = new List <Action>();
        foreach (ATTACK_TYPE attack in attacks)
        {
            switch (attack)
            {
            case ATTACK_TYPE.LEFT:
            {
                SlashLeft move = ScriptableObject.CreateInstance <SlashLeft>();
                move.animation = animation;
                move.puppet    = puppet;
                move.type      = Action.TYPE.SLASH;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.RIGHT:
            {
                SlashRight move = ScriptableObject.CreateInstance <SlashRight>();
                move.animation = animation;
                move.puppet    = puppet;
                move.type      = Action.TYPE.SLASH;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.TOP:
            {
                SlashTop move = ScriptableObject.CreateInstance <SlashTop>();
                move.animation = animation;
                move.puppet    = puppet;
                move.type      = Action.TYPE.SLASH;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.THRUST:
            {
                ThrustForward move = ScriptableObject.CreateInstance <ThrustForward>();
                move.animation = animation;
                move.puppet    = puppet;
                move.type      = Action.TYPE.SLASH;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.GUARD_LEFT:
            {
                GuardLeft move = ScriptableObject.CreateInstance <GuardLeft>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                move.type          = Action.TYPE.GUARD;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.GUARD_RIGHT:
            {
                GuardRight move = ScriptableObject.CreateInstance <GuardRight>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                move.type          = Action.TYPE.GUARD;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.GUARD_TOP:
            {
                GuardTop move = ScriptableObject.CreateInstance <GuardTop>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                move.type          = Action.TYPE.GUARD;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.REACTIVE_GUARD:
            {
                ReactiveGuard move = ScriptableObject.CreateInstance <ReactiveGuard>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                move.playerPuppet  = player.GetComponent <PuppetScript>();
                move.dances        = new List <string>();
                move.dances.Add("Twerk");
                move.dances.Add("Gangnam Style");
                move.dances.Add("Robot");
                move.type = Action.TYPE.GUARD;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.WINDOW_SHORT:
            {
                WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>();
                move.WindowTell = windowTell;
                move.animation  = animation;
                move.puppet     = puppet;
                move.TimerMax   = shortTimer;
                move.type       = Action.TYPE.WINDOW;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.WINDOW_MEDIUM:
            {
                WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>();
                move.WindowTell = windowTell;
                move.animation  = animation;
                move.puppet     = puppet;
                move.TimerMax   = mediumTimer;
                move.type       = Action.TYPE.WINDOW;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.WINDOW_LONG:
            {
                WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>();
                move.WindowTell = windowTell;
                move.animation  = animation;
                move.puppet     = puppet;
                move.TimerMax   = longTimer;
                move.type       = Action.TYPE.WINDOW;
                actions.Add(move);
            }
            break;
            }
        }
        agent.stoppingDistance = 0.0f;

        currentAction = actions[0];
    }
    void PopulateActions(List <ATTACK_TYPE> attacks, ref List <Action> actions)
    {
        actions = new List <Action>();
        foreach (ATTACK_TYPE attack in attacks)
        {
            switch (attack)
            {
            case ATTACK_TYPE.LEFT:
            {
                SlashLeft move = ScriptableObject.CreateInstance <SlashLeft>();
                move.animation = animation;
                move.puppet    = puppet;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.RIGHT:
            {
                SlashRight move = ScriptableObject.CreateInstance <SlashRight>();
                move.animation = animation;
                move.puppet    = puppet;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.TOP:
            {
                SlashTop move = ScriptableObject.CreateInstance <SlashTop>();
                move.animation = animation;
                move.puppet    = puppet;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.THRUST:
            {
                ThrustForward move = ScriptableObject.CreateInstance <ThrustForward>();
                move.animation = animation;
                move.puppet    = puppet;
                actions.Add(move);
                break;
            }

            case ATTACK_TYPE.GUARD_LEFT:
            {
                GuardLeft move = ScriptableObject.CreateInstance <GuardLeft>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.GUARD_RIGHT:
            {
                GuardRight move = ScriptableObject.CreateInstance <GuardRight>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.GUARD_TOP:
            {
                GuardTop move = ScriptableObject.CreateInstance <GuardTop>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.REACTIVE_GUARD:
            {
                ReactiveGuard move = ScriptableObject.CreateInstance <ReactiveGuard>();
                move.animation     = animation;
                move.puppet        = puppet;
                move.GuardTimerMax = guardTimer;
                move.playerPuppet  = player.GetComponent <PuppetScript>();
                move.dances        = new List <string>();
                move.dances.Add("Twerk");
                move.dances.Add("Gangnam Style");
                move.dances.Add("Robot");
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.WINDOW_SHORT:
            {
                WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>();
                move.animation = animation;
                move.puppet    = puppet;
                move.TimerMax  = shortTimer;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.WINDOW_MEDIUM:
            {
                WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>();
                move.animation = animation;
                move.puppet    = puppet;
                move.TimerMax  = mediumTimer;
                actions.Add(move);
            }
            break;

            case ATTACK_TYPE.WINDOW_LONG:
            {
                WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>();
                move.animation = animation;
                move.puppet    = puppet;
                move.TimerMax  = longTimer;
                actions.Add(move);
            }
            break;
            }
        }
    }