コード例 #1
0
    private void HandleGeneralMovementOptrions(MovementStateMachine machine)
    {
        for (int i = 0; i < generalOptionsData.Count; i++)
        {
            Type optionType = Type.GetType(generalOptionsData[i]);

            if (optionType == null)
            {
                throw new Exception($"Type does not exist {generalOptionsData[i]}");
            }

            EntityMovementOption movementOption;
            if (!GameObjectHasOptionComponent(machine.gameObject, optionType))
            {
                movementOption = machine.gameObject.AddComponent(optionType) as EntityMovementOption;
            }
            else
            {
                movementOption = machine.GetComponent(optionType) as EntityMovementOption;
            }
            machine.AddGeneralMovementOption(movementOption);
        }
    }
コード例 #2
0
 private void Reset()
 {
     OnValidate();
     EntiyMovementStateMachine.AddGeneralMovementOption(this);
 }