Example #1
0
    public bool Initialize(ICommandArgs args)
    {
        ChopCommandArgs commandArgs = args as ChopCommandArgs;

        if (commandArgs == null)
        {
            successful = false;
            finished   = true;
            throw new UnityException("Wrong type of args");
        }

        node = commandArgs.node;

        GameObject tree = node.GetBlock();

        if (!tree)
        {
            Stop();
            Debug.Log("No tree to chop");
            return(false);
        }

        spriteRenderer = tree.GetComponent <SpriteRenderer>();
        TickSystem.Subscribe(Chop);

        return(true);
    }
Example #2
0
    private void AddChopCommand()
    {
        ChopCommandArgs args = new ChopCommandArgs(node);
        Step            step = new Step(typeof(ChopCommand), args);

        stepList.Add(step);
    }