Exemplo n.º 1
0
    // at the start: //
    private void Start()
    {
        // track the locomotions managed by the hand's Locomotions Cycler as being managed by both Locomotions Cyclers //
        foreach (LocomotionCombination locomotionCombination in combinations)
        {
            foreach (GameObject cyclerManagedLocomotion in locomotionCombination.array)
            {
                if (!managedLocomotions.Contains(cyclerManagedLocomotion))
                {
                    managedLocomotions.Add(cyclerManagedLocomotion);
                }
            }
        }
        // track the locomotions that are children of the hand as being managed by both Locomotions Cyclers //
        foreach (GameObject handChildLocomotion in gameObject.localAndChildrenObjectsWithI <ILocomotion>())
        {
            if (managedLocomotions.doesNotContain(handChildLocomotion))
            {
                managedLocomotions.include(handChildLocomotion);
            }
        }
        // track the locomotions that are children of the player as being managed by both Locomotions Cyclers //
        foreach (GameObject playerChildLocomotion in MarsMotionPlayer.localAndChildrenObjectsWithI <ILocomotion>())
        {
            if (managedLocomotions.doesNotContain(playerChildLocomotion))
            {
                managedLocomotions.include(playerChildLocomotion);
            }
        }

        // track the other Locomotions Cycler instance //
        other = (leftInstance ? right : left);

        // refresh the locomotions //
        refreshLocomotions();
    }
Exemplo n.º 2
0
    // updating //


    // before the start: //
    private void Awake()
    {
        // connect to the hand //
        hand = transform.parent.GetComponent <Hand>();

        // determine whether this Locomotions Cycler belongs to the left hand (versus the right) //
        leftInstance = (hand.startingHandType == Hand.HandType.Left);

        // track the Locomotions Cycler instances //
        if (leftInstance)
        {
            left = this;
        }
        else
        {
            right = this;
        }

        // connect to the controller //
        controller = hand.GetComponent <Controller>();

        // ensure that the combinations array is not empty of combinations, setting it to have one combination empty of locomotions if it is //
        if (combinations.isEmpty())
        {
            combinations = new LocomotionCombination[] { new LocomotionCombination() };
        }

        // track the remembered locomotion combinations as the locomotion combinations as they are before the start //
        rememberedCombinations = combinations;

        // track the index at the previous update (when cycling was allowed) as the current index since it must be initialized //
        indexAtPreviousCyclingUpdate = index;

        // connect to the attached locomotion cycling audio //
        audioComponent = GetComponent <AudioSource>();
    }