Inheritance: MonoBehaviour
Example #1
0
        public void EnableSelected(TargetBehavior behavior)
        {
            standardOutline.enabled    = (behavior == TargetBehavior.Standard);
            holdOutline.enabled        = (behavior == TargetBehavior.Hold);
            horzOutline.enabled        = (behavior == TargetBehavior.Horizontal);
            vertOutline.enabled        = (behavior == TargetBehavior.Vertical);
            chainStartOutline.enabled  = (behavior == TargetBehavior.ChainStart);
            chainOutline.enabled       = (behavior == TargetBehavior.Chain);
            meleeOutline.enabled       = (behavior == TargetBehavior.Melee);
            mineOutline.enabled        = (behavior == TargetBehavior.Mine);
            pathBuilderOutline.enabled = (behavior == TargetBehavior.NR_Pathbuilder);
            if (pathBuilderArrow != null)
            {
                pathBuilderArrow.SetActive((behavior == TargetBehavior.NR_Pathbuilder));
            }

            isSelected = true;

            if (location == TargetIconLocation.Grid)
            {
                foreach (LineRenderer l in gameObject.GetComponentsInChildren <LineRenderer>(true))
                {
                    l.enabled = true;
                }
            }
        }
Example #2
0
    private void Start()
    {
        storyCamera = GameObject.FindGameObjectWithTag("MainCamera");
        mouseLook   = storyCamera.GetComponent <MouseLook>();
        playerShoot = player.GetComponentInChildren <PlayerShoot>();
        player.GetComponentInChildren <PlayerMovement>().enabled = false;

        StateManager.inStoryTutorial = true;

        playerShoot.enabled = false;
        introStory1         = storiesTop[storyPosition];
        introStory2         = storiesBottom[storyPosition];
        Time.timeScale      = 0;
        mouseLook.enabled   = false;
        foreach (GameObject weapon in tutorialWeapons)
        {
            GameObject realWeapon = Instantiate(weapon);
            playerInventory.addWeapon(realWeapon);
        }
        foreach (GameObject target in targets)
        {
            TargetBehavior behaviorScript = target.GetComponent <TargetBehavior>();
            behaviorScript.story = this;
        }
    }
Example #3
0
        private void OnBehaviorChanged(TargetBehavior oldbehavior, TargetBehavior behavior)
        {
            standard.SetActive(behavior == TargetBehavior.Standard);
            hold.SetActive(behavior == TargetBehavior.Hold);
            horizontal.SetActive(behavior == TargetBehavior.Horizontal);
            vertical.SetActive(behavior == TargetBehavior.Vertical);
            chainStart.SetActive(behavior == TargetBehavior.ChainStart);
            chain.SetActive(behavior == TargetBehavior.Chain);
            melee.SetActive(behavior == TargetBehavior.Melee);
            mine.SetActive(behavior == TargetBehavior.Mine);
            pathBuilder.SetActive(behavior == TargetBehavior.NR_Pathbuilder);

            if (location == TargetIconLocation.Timeline)
            {
                line.SetActive(data.supportsBeatLength);
            }

            if (behavior == TargetBehavior.Chain && location == TargetIconLocation.Timeline)
            {
                collisionRadius = 0.25f;
            }

            if (behavior == TargetBehavior.NR_Pathbuilder)
            {
                data.velocity = TargetVelocity.None;
            }
        }
Example #4
0
    void TargetBehaviorCal()
    {
        // check the target is exist
        if (Target)
        {
            // check if Target on move or static
            Vector3 delta = (targetpositionTemp - Target.transform.position);
            // check height from the target.
            float deltaheight = Mathf.Abs(targetpositionTemp.y - Target.transform.position.y);
            targetpositionTemp = Target.transform.position;

            if (delta == Vector3.zero)
            {
                // Static target
                targetHavior = TargetBehavior.Static;
            }
            else
            {
                // Movine target
                targetHavior = TargetBehavior.Moving;
                // Flying target
                if (deltaheight > 0.5f)
                {
                    targetHavior = TargetBehavior.Flying;
                }
            }
        }
        if (CenterOfBattle && CenterOfBattle.FixedFloor)
        {
            if (flight.PositionTarget.y < BattlePosition.y)
            {
                flight.PositionTarget.y = BattlePosition.y;
            }
        }
    }
Example #5
0
        private void OnBehaviorChanged(TargetBehavior oldBehavior, TargetBehavior newBehavior)
        {
            if (data.supportsBeatLength)
            {
                if (!TargetData.BehaviorSupportsBeatLength(oldBehavior))
                {
                    var gridHoldTargetManager = gridTargetIcon.GetComponentInChildren <HoldTargetManager>();

                    if (gridHoldTargetManager != null)
                    {
                        gridHoldTargetManager.sustainLength = data.beatLength;
                        gridHoldTargetManager.LoadSustainController();

                        gridHoldTargetManager.OnTryChangeSustainEvent += MakeTimelineUpdateSustainLength;
                    }
                }

                gridTargetIcon.UpdatePath();
            }
            else
            {
                DisableSustainButtons();

                if (TargetData.BehaviorSupportsBeatLength(oldBehavior))
                {
                    var gridHoldTargetManager = gridTargetIcon.GetComponentInChildren <HoldTargetManager>(true);
                    if (gridHoldTargetManager != null)
                    {
                        gridHoldTargetManager.UnloadSustainController();
                        gridHoldTargetManager.OnTryChangeSustainEvent -= MakeTimelineUpdateSustainLength;
                    }
                }
            }

            if (data.behavior == TargetBehavior.NR_Pathbuilder)
            {
                data.pathBuilderData.InitialAngleChangedEvent += UpdatePathInitialAngle;
                data.pathBuilderData.RecalculateEvent         += RecalculatePathbuilderData;
                data.pathBuilderData.RecalculateFinishedEvent += UpdatePath;
            }

            if (oldBehavior == TargetBehavior.NR_Pathbuilder)
            {
                data.pathBuilderData.InitialAngleChangedEvent -= UpdatePathInitialAngle;
                data.pathBuilderData.RecalculateEvent         -= RecalculatePathbuilderData;
                data.pathBuilderData.RecalculateFinishedEvent -= UpdatePath;
            }

            if (data.behavior != TargetBehavior.NR_Pathbuilder && oldBehavior == TargetBehavior.NR_Pathbuilder)
            {
                data.pathBuilderData.parentNotes.Remove(data);
            }
            else if (data.behavior == TargetBehavior.NR_Pathbuilder)
            {
                data.pathBuilderData.parentNotes.Add(data);
            }
        }
Example #6
0
 public TargetData(Target target)
 {
     x          = target.gridTargetIcon.transform.localPosition.x;
     y          = target.gridTargetIcon.transform.localPosition.y;
     beatTime   = target.gridTargetIcon.transform.localPosition.z;
     beatLength = target.beatLength;
     velocity   = target.velocity;
     handType   = target.handType;
     behavior   = target.behavior;
 }
Example #7
0
 public void SetBehavior(TargetBehavior behavior)
 {
     standard.SetActive(behavior == TargetBehavior.Standard);
     hold.SetActive(behavior == TargetBehavior.Hold);
     horizontal.SetActive(behavior == TargetBehavior.Horizontal);
     vertical.SetActive(behavior == TargetBehavior.Vertical);
     chainStart.SetActive(behavior == TargetBehavior.ChainStart);
     chain.SetActive(behavior == TargetBehavior.Chain);
     melee.SetActive(behavior == TargetBehavior.Melee);
 }
 public void ChooseVideo()
 {
     NativeGallery.Permission permission = NativeGallery.GetVideoFromGallery((path) =>
     {
         TargetBehavior target = FindObjectOfType <TargetBehavior>();
         if (path != null && target != null)
         {
             target.OnVideoChosen(path);
         }
     }, "Select a video'");
 }
Example #9
0
        private void SetBehaviorAction(TargetBehavior behavior)
        {
            NRActionSetTargetBehavior setBehaviorAction = new NRActionSetTargetBehavior();

            setBehaviorAction.newBehavior = behavior;
            timeline.selectedNotes.ForEach(target => {
                setBehaviorAction.affectedTargets.Add(target.data);
            });

            timeline.SetTargetBehaviors(setBehaviorAction);
        }
Example #10
0
    // This function is called when a object is collided with another
    private void OnTriggerEnter(Collider other)
    {
        // Gets the target behavior for reference
        TargetBehavior enemy = other.GetComponent <TargetBehavior>();

        // If enemy is not fale or null call its Destroy function.
        if (enemy)
        {
            enemy.Destroy();
        }
    }
Example #11
0
        protected override void UpdateTool(InputSource inputSource)
        {
            if (_currentTargetBehavior?.Grabbable ?? false)
            {
                _grabTool.Update(inputSource, Target);
                if (_grabTool.GrabActive)
                {
                    // If a grab is active, nothing should change about the current target.
                    return;
                }
            }

            var newTarget = FindTarget(inputSource);

            if (Target == newTarget)
            {
                return;
            }

            if (Target != null && _currentTargetBehavior != null)
            {
                var mwUser = _currentTargetBehavior.GetMWUnityUser(inputSource.UserGameObject);
                if (mwUser != null)
                {
                    _currentTargetBehavior.Target.StopAction(mwUser);
                }
            }

            TargetBehavior newBehavior = null;

            if (newTarget != null)
            {
                newBehavior = newTarget.GetBehavior <TargetBehavior>();
                var mwUser = newBehavior.GetMWUnityUser(inputSource.UserGameObject);
                if (mwUser != null)
                {
                    newBehavior.Target.StartAction(mwUser);
                }
            }

            OnTargetChanged(Target, newTarget, inputSource);
            Target = newTarget;

            if (newBehavior != null)
            {
                if (newBehavior.GetDesiredToolType() != inputSource.CurrentTool.GetType())
                {
                    inputSource.HoldTool(newBehavior.GetDesiredToolType());
                }

                _currentTargetBehavior = newBehavior;
            }
        }
Example #12
0
        public TargetData(Cue cue, float offset)
        {
            Vector2 pos = NotePosCalc.PitchToPos(cue);

            x          = pos.x;
            y          = pos.y;
            beatTime   = (cue.tick - offset) / 480f;
            beatLength = cue.tickLength;
            velocity   = cue.velocity;
            handType   = cue.handType;
            behavior   = cue.behavior;
        }
Example #13
0
        public void EnableSelected(TargetBehavior behavior)
        {
            standardOutline.enabled   = (behavior == TargetBehavior.Standard);
            holdOutline.enabled       = (behavior == TargetBehavior.Hold);
            horzOutline.enabled       = (behavior == TargetBehavior.Horizontal);
            vertOutline.enabled       = (behavior == TargetBehavior.Vertical);
            chainStartOutline.enabled = (behavior == TargetBehavior.ChainStart);
            chainOutline.enabled      = (behavior == TargetBehavior.Chain);
            meleeOutline.enabled      = (behavior == TargetBehavior.Melee);

            isSelected = true;
        }
Example #14
0
        public void EnableSelected(TargetBehavior behavior)
        {
            selection.enabled = true;

            isSelected = true;

            if (location == TargetIconLocation.Grid)
            {
                foreach (LineRenderer l in gameObject.GetComponentsInChildren <LineRenderer>(true))
                {
                    l.enabled = true;
                }
            }
        }
Example #15
0
        private void OnBehaviorChanged(TargetBehavior behavior)
        {
            standard.SetActive(behavior == TargetBehavior.Standard);
            hold.SetActive(behavior == TargetBehavior.Hold);
            horizontal.SetActive(behavior == TargetBehavior.Horizontal);
            vertical.SetActive(behavior == TargetBehavior.Vertical);
            chainStart.SetActive(behavior == TargetBehavior.ChainStart);
            chain.SetActive(behavior == TargetBehavior.Chain);
            melee.SetActive(behavior == TargetBehavior.Melee);

            sphereCollider.radius = 0.5f;
            if (behavior == TargetBehavior.Chain && location == TargetIconLocation.Timeline)
            {
                sphereCollider.radius = 0.25f;
            }
        }
	void TargetBehaviorCal ()
	{
		
		if (Target) {
			Vector3 delta = (targetpositionTemp - Target.transform.position);
			float deltaheight = Mathf.Abs (targetpositionTemp.y - Target.transform.position.y); 
			targetpositionTemp = Target.transform.position;
			
			if (delta == Vector3.zero) {
				targetHavior = TargetBehavior.Static;	
			} else {
				targetHavior = TargetBehavior.Moving;
				if (deltaheight > 0.5f) {
					targetHavior = TargetBehavior.Flying;	
				}
			}
		}
	}
Example #17
0
        protected override void OnTargetChanged(
            GameObject oldTarget,
            Vector3 oldTargetPosition,
            GameObject newTarget,
            Vector3 newTargetPosition,
            TargetBehavior newBehavior,
            InputSource inputSource)
        {
            base.OnTargetChanged(
                oldTarget,
                oldTargetPosition,
                newTarget,
                newTargetPosition,
                newBehavior,
                inputSource);

            if (oldTarget != null)
            {
                var oldBehavior = oldTarget.GetBehavior <ButtonBehavior>();
                if (oldBehavior != null)
                {
                    var mwUser = oldBehavior.GetMWUnityUser(inputSource.UserGameObject);
                    if (mwUser != null)
                    {
                        oldBehavior.Context.EndHover(mwUser, oldTargetPosition);
                    }
                }
            }

            if (newTarget != null)
            {
                var newButtonBehavior = newBehavior as ButtonBehavior;
                if (newButtonBehavior != null)
                {
                    var mwUser = newButtonBehavior.GetMWUnityUser(inputSource.UserGameObject);
                    if (mwUser != null)
                    {
                        newButtonBehavior.Context.StartHover(mwUser, newTargetPosition);
                    }
                }
            }
        }
        protected override void OnTargetChanged(
            Spatial oldTarget,
            Vector3 oldTargetPosition,
            Spatial newTarget,
            Vector3 newTargetPosition,
            TargetBehavior newBehavior,
            InputSource inputSource)
        {
            base.OnTargetChanged(
                oldTarget,
                oldTargetPosition,
                newTarget,
                newTargetPosition,
                newBehavior,
                inputSource);

            if (oldTarget != null && Godot.Object.IsInstanceValid(oldTarget))
            {
                var oldBehavior = oldTarget.GetBehavior <ButtonBehavior>();
                if (oldBehavior != null)
                {
                    var mwUser = oldBehavior.GetMWUnityUser(inputSource.UserNode);
                    if (mwUser != null)
                    {
                        oldBehavior.Context.EndHover(mwUser, oldTargetPosition);
                    }
                }
            }

            if (newTarget != null && Godot.Object.IsInstanceValid(newTarget))
            {
                var newButtonBehavior = newBehavior as ButtonBehavior;
                if (newButtonBehavior != null)
                {
                    var mwUser = newButtonBehavior.GetMWUnityUser(inputSource.UserNode);
                    if (mwUser != null)
                    {
                        newButtonBehavior.Context.StartHover(mwUser, newTargetPosition);
                    }
                }
            }
        }
Example #19
0
        private void OnBehaviorChanged(TargetBehavior oldBehavior, TargetBehavior newBehavior)
        {
            if (data.supportsBeatLength)
            {
                var gridHoldTargetManager = gridTargetIcon.GetComponentInChildren <HoldTargetManager>();

                gridHoldTargetManager.sustainLength = data.beatLength;
                gridHoldTargetManager.LoadSustainController();

                gridHoldTargetManager.OnTryChangeSustainEvent += MakeTimelineUpdateSustainLength;

                if (data.beatLength < 480 && data.behavior != TargetBehavior.NR_Pathbuilder)
                {
                    data.beatLength = 480;
                }

                if (data.beatLength == 120 && data.behavior == TargetBehavior.NR_Pathbuilder)
                {
                    data.beatLength = 480;
                }

                gridTargetIcon.UpdatePath();
            }
            else
            {
                DisableSustainButtons();
            }

            if (data.behavior == TargetBehavior.NR_Pathbuilder)
            {
                data.pathBuilderData.InitialAngleChangedEvent += UpdatePathInitialAngle;
                data.pathBuilderData.RecalculateEvent         += RecalculatePathbuilderData;
                data.pathBuilderData.RecalculateFinishedEvent += UpdatePath;
            }

            if (oldBehavior == TargetBehavior.NR_Pathbuilder)
            {
                data.pathBuilderData.InitialAngleChangedEvent -= UpdatePathInitialAngle;
                data.pathBuilderData.RecalculateEvent         -= RecalculatePathbuilderData;
                data.pathBuilderData.RecalculateFinishedEvent -= UpdatePath;
            }
        }
Example #20
0
        public void CreateTarget(QNT_Timestamp time, TargetBehavior behavior, TargetHandType hand, Vector2?position = null)
        {
            if (!position.HasValue)
            {
                position = new Vector2(0, 0);
            }

            TargetData data = new TargetData();

            data.x        = position.Value.x;
            data.y        = position.Value.y;
            data.handType = hand;
            data.behavior = behavior;
            data.SetTimeFromAction(time);

            var action = new NRActionAddNote {
                targetData = data
            };

            timeline.Tools.undoRedoManager.AddAction(action);
        }
Example #21
0
        private void OnBehaviorChanged(TargetBehavior oldbehavior, TargetBehavior behavior)
        {
            ResetSpriteTransforms();

            UpdateSpriteForBehavior(behavior);

            if (pathBuilder != null)
            {
                pathBuilder.SetActive(behavior == TargetBehavior.NR_Pathbuilder);
            }

            if (location == TargetIconLocation.Timeline)
            {
                line.SetActive(data.supportsBeatLength);
                transform.localScale = Vector3.one * timelineTargetSize * 0.4f;
                collisionRadius      = 0.50f;
            }
            else
            {
                transform.localScale = Vector3.one * timelineTargetSize * 0.4f;
            }


            if (behavior == TargetBehavior.Chain && location == TargetIconLocation.Timeline)
            {
                collisionRadius = 0.4f;
            }
            else if (behavior == TargetBehavior.Melee && location == TargetIconLocation.Grid)
            {
                collisionRadius = 1.7f;
            }

            if (behavior == TargetBehavior.NR_Pathbuilder)
            {
                data.velocity = TargetVelocity.None;
            }

            Timeline.instance.ReapplyScale();
            UpdateTimelineSustainLength();
        }
        protected virtual void OnTargetChanged(
            Spatial oldTarget,
            Vector3 oldTargetPoint,
            Spatial newTarget,
            Vector3 newTargetPoint,
            TargetBehavior newBehavior,
            InputSource inputSource)
        {
            if (oldTarget != null && Godot.Object.IsInstanceValid(oldTarget))
            {
                _currentTargetBehavior.Context.EndTargeting(_currentTargetBehavior.GetMWUnityUser(inputSource.UserNode), oldTargetPoint);
            }

            if (newTarget != null && Godot.Object.IsInstanceValid(newTarget))
            {
                newBehavior.Context.StartTargeting(newBehavior.GetMWUnityUser(inputSource.UserNode), newTargetPoint);
            }

            CurrentTargetPoint     = newTargetPoint;
            Target                 = newTarget;
            _currentTargetBehavior = newBehavior;
        }
Example #23
0
        protected virtual void OnTargetChanged(
            GameObject oldTarget,
            Vector3 oldTargetPoint,
            GameObject newTarget,
            Vector3 newTargetPoint,
            TargetBehavior newBehavior,
            InputSource inputSource)
        {
            if (oldTarget != null)
            {
                _currentTargetBehavior.Context.EndTargeting(_currentTargetBehavior.GetMWUnityUser(inputSource.UserGameObject), oldTargetPoint);
            }

            if (newTarget != null)
            {
                newBehavior.Context.StartTargeting(newBehavior.GetMWUnityUser(inputSource.UserGameObject), newTargetPoint);
            }

            CurrentTargetPoint     = newTargetPoint;
            Target                 = newTarget;
            _currentTargetBehavior = newBehavior;
        }
Example #24
0
    void TargetBehaviorCal()
    {
        if (Target)
        {
            Vector3 delta       = (targetpositionTemp - Target.transform.position);
            float   deltaheight = Mathf.Abs(targetpositionTemp.y - Target.transform.position.y);
            targetpositionTemp = Target.transform.position;

            if (delta == Vector3.zero)
            {
                targetHavior = TargetBehavior.Static;
            }
            else
            {
                targetHavior = TargetBehavior.Moving;
                if (deltaheight > 0.5f)
                {
                    targetHavior = TargetBehavior.Flying;
                }
            }
        }
    }
Example #25
0
 public static Mesh GetMeshForBehavior(TargetBehavior behavior) =>
 behavior switch
 {
Example #26
0
 internal void SetBehavior(TargetBehavior behavior)
 {
     gridTarget.behavior = behavior;
     timelineTarget.icon.SetBehavior(behavior);
     gridTarget.icon.SetBehavior(behavior);
 }
    // public function that can be called to update the score or time
    public void targetHit(TargetBehavior tb, int scoreAmount, float timeAmount)
    {
        Shooter s = player.GetComponentInChildren <Shooter> ();

        // increase the score by the scoreAmount and update the text UI
        score += scoreAmount;
        if (score >= 0 && score <= 30)
        {
            s.setArmor(1);


            Debug.Log("Armor 1");
        }
        else if (score > 30 && score <= 100)
        {
            s.setArmor(2);
            Debug.Log("Armor 2");
            // set the current time to the startTime specified
            currentTime = startTime;

            this.nextLevelToLoad = "Level2";
            if (level2Labels)
            {
                level2Labels.SetActive(true);
            }
        }
        else if (score > 100 && score <= 200)
        {
            s.setArmor(3);
            Debug.Log("Armor 3");
            // set the current time to the startTime specified
            currentTime = startTime;

            this.nextLevelToLoad = "Level3";
            if (level3Labels)
            {
                level3Labels.SetActive(true);
            }
        }
        else if (score > 200 && score <= 300)
        {
            s.setArmor(4);
            Debug.Log("Armor 4");
            // set the current time to the startTime specified
            currentTime = startTime;

            this.nextLevelToLoad = "Level4";
            if (level4Labels)
            {
                level4Labels.SetActive(true);
            }
            if (enemies)
            {
                enemies.SetActive(true);
            }
            if (boss)
            {
                boss.SetActive(true);
            }

            if (bossLife)
            {
                bossLife.enabled = true;
            }
            if (bossLifeValue)
            {
                bossLifeValue.enabled = true;
            }
        }
        else if (score > 360)
        {
            s.setArmor(5);
            this.nextLevelToLoad = "YOUWIN";
            Debug.Log("You Win");
            gameIsOver = true;
            // set the current time to the startTime specified
            //currentTime = startTime;
        }
        mainScoreDisplay.text = score.ToString();

        // increase the time by the timeAmount
        currentTime += timeAmount;

        // don't let it go negative
        if (currentTime < 0)
        {
            currentTime = 0.0f;
        }

        // update the text UI
        mainTimerDisplay.text = currentTime.ToString("0.00");
    }
Example #28
0
        public static void CalculateChainNotes(TargetData data)
        {
            if (data.behavior != TargetBehavior.NR_Pathbuilder)
            {
                return;
            }

            if (data.pathBuilderData.createdNotes)
            {
                data.pathBuilderData.generatedNotes.ForEach(t => {
                    timeline.DeleteTargetFromAction(t);
                });
                data.pathBuilderData.createdNotes = false;
            }

            data.pathBuilderData.generatedNotes = new List <TargetData>();

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            /////////                                            WARNING!                                                      /////////
            /////////       Chainging this calculation breaks backwards compatibility with saves of older NotReaper versions!  /////////
            /////////                    Make sure to update NRCueData.Version, and handle an upgrade path!                    /////////
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            //Generate first note at the start
            TargetData firstData = new TargetData();

            firstData.behavior = data.pathBuilderData.behavior;
            firstData.velocity = data.pathBuilderData.velocity;
            firstData.handType = data.pathBuilderData.handType;
            firstData.beatTime = data.beatTime;
            firstData.position = data.position;
            data.pathBuilderData.generatedNotes.Add(firstData);

            //We increment as if all these values were for 1/4 notes over 4 beats, makes the ui much better
            float quarterIncrConvert = (4.0f / data.pathBuilderData.interval) * (480.0f * 4.0f / data.beatLength);

            //Generate new notes
            Vector2 currentPos   = data.position;
            Vector2 currentDir   = new Vector2(Mathf.Sin(data.pathBuilderData.initialAngle * Mathf.Deg2Rad), Mathf.Cos(data.pathBuilderData.initialAngle * Mathf.Deg2Rad));
            float   currentAngle = (data.pathBuilderData.angle / 4) * quarterIncrConvert;
            float   currentStep  = data.pathBuilderData.stepDistance * quarterIncrConvert;

            TargetBehavior generatedBehavior = data.pathBuilderData.behavior;

            if (generatedBehavior == TargetBehavior.ChainStart)
            {
                generatedBehavior = TargetBehavior.Chain;
            }

            TargetVelocity generatedVelocity = data.pathBuilderData.velocity;

            if (generatedVelocity == TargetVelocity.ChainStart)
            {
                generatedVelocity = TargetVelocity.Chain;
            }

            for (int i = 1; i <= (data.beatLength / 480) * (data.pathBuilderData.interval / 4.0f); ++i)
            {
                currentPos += currentDir * currentStep;
                currentDir  = currentDir.Rotate(currentAngle);

                currentAngle += (data.pathBuilderData.angleIncrement / 4) * quarterIncrConvert;
                currentStep  += data.pathBuilderData.stepIncrement * quarterIncrConvert;

                TargetData newData = new TargetData();
                newData.behavior = generatedBehavior;
                newData.velocity = generatedVelocity;
                newData.handType = data.pathBuilderData.handType;
                newData.beatTime = data.beatTime + i * (4.0f / data.pathBuilderData.interval);
                newData.position = currentPos;
                data.pathBuilderData.generatedNotes.Add(newData);
            }

            data.pathBuilderData.OnFinishRecalculate();
        }
Example #29
0
        private void UpdateSpriteForBehavior(TargetBehavior behavior)
        {
            switch (behavior)
            {
            case TargetBehavior.Standard:
                note.sprite = standard;
                if (prefade != null)
                {
                    prefade.sprite = standardTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = standardRing;
                }
                selection.sprite = standardSelect;
                break;

            case TargetBehavior.Hold:
                note.sprite = hold;
                if (prefade != null)
                {
                    prefade.sprite = holdTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = holdRing;
                }
                selection.sprite = holdSelect;
                break;

            case TargetBehavior.Horizontal:
                note.sprite = horizontal;
                if (prefade != null)
                {
                    prefade.sprite = horizontalTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = horizontalRing;
                }
                selection.sprite = horizontalSelect;

                if (location == TargetIconLocation.Grid)
                {
                    note.transform.localRotation      = Quaternion.Euler(0f, 0f, -45f);
                    prefade.transform.localRotation   = Quaternion.Euler(0f, 0f, -45f);
                    ring.transform.localRotation      = Quaternion.Euler(0f, 0f, -45f);
                    selection.transform.localRotation = Quaternion.Euler(0f, 0f, -45f);
                }
                else
                {
                    note.transform.localRotation      = Quaternion.Euler(0f, 0f, 90f);
                    selection.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
                }
                break;

            case TargetBehavior.Vertical:
                note.sprite = vertical;
                if (prefade != null)
                {
                    prefade.sprite = verticalTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = verticalRing;
                }
                selection.sprite = verticalSelect;


                if (location == TargetIconLocation.Grid)
                {
                    note.transform.localRotation      = Quaternion.Euler(0f, 0f, 45f);
                    prefade.transform.localRotation   = Quaternion.Euler(0f, 0f, 45f);
                    ring.transform.localRotation      = Quaternion.Euler(0f, 0f, 45f);
                    selection.transform.localRotation = Quaternion.Euler(0f, 0f, 45f);
                }
                else
                {
                    note.transform.localRotation      = Quaternion.Euler(0f, 0f, 0f);
                    selection.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
                }
                break;

            case TargetBehavior.ChainStart:
                note.sprite = chainStart;
                if (prefade != null)
                {
                    prefade.sprite = chainStartTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = chainStartRing;
                }
                selection.sprite = chainStartSelect;

                if (location == TargetIconLocation.Grid)
                {
                    note.transform.localScale = Vector3.one * 1.7f;
                }
                else
                {
                    note.transform.localScale = Vector3.one * 0.7f;
                }
                break;

            case TargetBehavior.Chain:
                note.sprite = chain;
                if (prefade != null)
                {
                    prefade.sprite = chainTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = chainRing;
                }
                selection.sprite = chainSelect;
                if (location == TargetIconLocation.Timeline)
                {
                    note.transform.localScale = Vector3.one * 0.2f;
                }
                break;

            case TargetBehavior.Melee:
                note.sprite = melee;
                if (prefade != null)
                {
                    prefade.sprite = meleeTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = meleeRing;
                }
                selection.sprite = meleeSelect;
                if (location == TargetIconLocation.Grid)
                {
                    note.transform.localScale      = Vector3.one * 1.5f;
                    selection.transform.localScale = Vector3.one * 1.25f;
                    ring.transform.localScale      = Vector3.one * 1.5f;
                }
                break;

            case TargetBehavior.Mine:
                note.sprite = mine;
                if (prefade != null)
                {
                    prefade.sprite = mineTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = mineRing;
                }
                selection.sprite = mineSelect;
                break;

            case TargetBehavior.NR_Pathbuilder:
                note.sprite = pathbuilder;
                if (prefade != null)
                {
                    prefade.sprite = chainTelegraph;
                }
                if (ring != null)
                {
                    ring.sprite = chainRing;
                }
                selection.sprite = chainSelect;
                break;

            default:
                break;
            }
        }
Example #30
0
 // Use this for initialization
 void Start()
 {
     _gameManager = GameObject.Find("Main Camera").GetComponent<GameManager>();
     _behavior = GameObject.Find("TargetPaddle(Clone)").GetComponent<TargetBehavior>();
     _ball = GameObject.Find("Ball").GetComponent<Ball>();
 }
Example #31
0
        public void SelectTool(EditorTool tool)
        {
            if (tool == selectedTool)
            {
                return;
            }

            uiToolSelect.UpdateUINoteSelected(tool);

            hover.UpdateUITool(tool);

            previousTool = selectedTool;
            selectedTool = tool;

            if (previousTool == EditorTool.Melee && selectedHand == TargetHandType.Either)
            {
                SelectHand(previousHand);
            }

            //Update the UI based on the tool:
            switch (tool)
            {
            case EditorTool.Standard:
                selectedBehavior = TargetBehavior.Standard;
                soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard);
                SelectVelocity(UITargetVelocity.Standard);
                SelectSnappingMode(SnappingMode.Grid);


                break;

            case EditorTool.Hold:
                selectedBehavior = TargetBehavior.Hold;
                soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard);
                SelectVelocity(UITargetVelocity.Standard);
                SelectSnappingMode(SnappingMode.Grid);
                break;

            case EditorTool.Horizontal:
                selectedBehavior = TargetBehavior.Horizontal;
                soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard);
                SelectVelocity(UITargetVelocity.Standard);
                SelectSnappingMode(SnappingMode.Grid);
                break;

            case EditorTool.Vertical:
                selectedBehavior = TargetBehavior.Vertical;
                soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Standard);
                SelectVelocity(UITargetVelocity.Standard);
                SelectSnappingMode(SnappingMode.Grid);
                break;

            case EditorTool.ChainStart:
                selectedBehavior = TargetBehavior.ChainStart;
                soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.ChainStart);
                SelectVelocity(UITargetVelocity.ChainStart);
                SelectSnappingMode(SnappingMode.Grid);
                break;

            case EditorTool.ChainNode:
                selectedBehavior = TargetBehavior.Chain;
                soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Chain);
                SelectVelocity(UITargetVelocity.Chain);
                SelectSnappingMode(SnappingMode.None);
                break;

            case EditorTool.Melee:
                selectedBehavior = TargetBehavior.Melee;
                previousHand     = selectedHand;
                soundDropdown.SetValueWithoutNotify((int)UITargetVelocity.Melee);
                SelectVelocity(UITargetVelocity.Melee);
                SelectSnappingMode(SnappingMode.Melee);
                SelectHand(TargetHandType.Either);
                break;

            case EditorTool.DragSelect:
                selectedBehavior = TargetBehavior.None;


                Tools.dragSelect.Activate(true);
                Tools.chainBuilder.Activate(false);
                break;

            case EditorTool.ChainBuilder:
                selectedBehavior = TargetBehavior.None;

                Tools.dragSelect.Activate(false);
                Tools.chainBuilder.Activate(true);
                break;


            default:
                break;
            }

            if (tool != EditorTool.ChainBuilder)
            {
                Tools.chainBuilder.Activate(false);
            }

            if (tool != EditorTool.DragSelect)
            {
                Tools.dragSelect.Activate(false);
            }
        }
Example #32
0
    // Start is called before the first frame update
    void Start()
    {
        targetBehavior = GetComponent <TargetBehavior>();

        StartCoroutine(DoEveryTwoSeconds());
    }