Esempio n. 1
0
    /**
     * init the right strategy (selected by dropdown in the inspector)
     */
    private IMoveBehaviorStrategy SetStrategyByDropDown()
    {
        IMoveBehaviorStrategy strategy = null;

        switch (_behave)
        {
        case MoveBehaviorEnum.Circle:
            strategy = new CircleMove();
            break;

        case MoveBehaviorEnum.Straight_Line:
            strategy = new StraightMove();
            break;

        default:
            Debug.LogError("Something went wrong with the strategy enum");
            break;
        }
        return(strategy);
    }
Esempio n. 2
0
    private void Start()
    {
        MoveBehaviour = SetStrategyByDropDown();
        MoveBehaviour.Init(gObj, gRef, _time, _direction, _turnObject);
        MoveBehaviour.StartMovement();

        if (_loop._activate_Loop)
        {
            if (_loop._enable)
            {
                InvokeRepeating("InvokeTurnAround", _time * _loop._time_percent, _time * _loop._time_percent);
            }
            else
            {
                // do nothing
            }
        }
        else
        {
            Invoke("Stop", _time);
        }
    }