Example #1
0
    Task BuildTask()
    {
        Renderer    renderer = GetComponent <Renderer>();
        List <Task> taskList = new List <Task>();

        Task wait       = new Wait(1f);
        Task turnRed    = new TurnRed(renderer);
        Task turnYellow = new TurnYellow(renderer);
        Task turnBlue   = new TurnBlue(renderer);

        taskList.Add(turnRed);
        taskList.Add(wait);
        taskList.Add(turnYellow);
        taskList.Add(wait);
        taskList.Add(turnBlue);

        Sequence sequence = new Sequence(taskList);

        taskList = new List <Task>();

        taskList.Add(sequence);

        Selector selector = new Selector(taskList);

        return(selector);
    }
Example #2
0
        // Start is called before the first frame update
        private void Start()
        {
            _turnRed = gameObject.GetComponent <TurnRed>();
            selected = PlayerPrefs.GetInt("Selcted");

            switch (selected)
            {
            case 1:
                sprite.sprite = bow;
                break;

            case 2:
                sprite.sprite = crossbow;
                break;

            case 3:
                sprite.sprite = dual;
                break;

            case 4:
                sprite.sprite = sniper;
                var light = gameObject.GetComponentsInChildren <Light2D>();
                foreach (var light2D in light)
                {
                    light2D.pointLightOuterRadius *= 2;
                }
                break;

            case 5:
                sprite.sprite = uzi;
                break;
            }
        }