コード例 #1
0
    public void SetState(StarState state)
    {
        switch (state)
        {
        case StarState.DEFAULT:
            neighborIndicator.SetActive(false);
            isNeighbour = false;
            playerLocationIndicator.SetActive(false);
            break;

        case StarState.VISITED:
            GetComponentInChildren <SpriteRenderer>().color = visitedColor;
            break;

        case StarState.PLAYER_POSITION:
            playerLocationIndicator.SetActive(true);
            break;

        case StarState.NEIGHBOUR:
            neighborIndicator.SetActive(true);
            isNeighbour = true;
            break;

        default:
            break;
        }
    }
コード例 #2
0
 public static void PushState(StarState state, bool start = true)
 {
     States.Push(state);
     state.InitState();
     state.Running = true;
     state.StartState();
 }
コード例 #3
0
        public override void Update()
        {
            if (CurStarState == StarState.Expanding)
            {
                CurScale.X = UtilityGlobals.Clamp(CurScale.X + ScaleRate, 0f, MaxScale.X);
                CurScale.Y = UtilityGlobals.Clamp(CurScale.Y + ScaleRate, 0f, MaxScale.Y);

                if (CurScale == MaxScale)
                {
                    CurStarState = StarState.Waiting;
                }
            }
            else if (CurStarState == StarState.Waiting)
            {
                //Increment time and check if it should start shrinking
                ElapsedTime += Time.ElapsedMilliseconds;
                if (ElapsedTime >= DisplayTime)
                {
                    CurStarState = StarState.Shrinking;
                }
            }
            else
            {
                //Shrink the star
                CurScale.X = UtilityGlobals.Clamp(CurScale.X - ScaleRate, 0f, MaxScale.X);
                CurScale.Y = UtilityGlobals.Clamp(CurScale.Y - ScaleRate, 0f, MaxScale.Y);

                if (CurScale == Vector2.Zero)
                {
                    ReadyForRemoval = true;
                }
            }
        }
コード例 #4
0
ファイル: Star.cs プロジェクト: Qommon/GGJ2021
 public void VomitStar(Vector3 position)
 {
     if (m_State != StarState.InBody)
     {
         return;
     }
     m_State = StarState.Idle;
     owner   = null;
 }
コード例 #5
0
        public void StarTransition(Peach peach)
        {
            sound = peach.Content.Load <SoundEffect>("Sound Effects/Power Up");
            sound.Play();
            var state = new StarState(this);

            peach.PowerUpState = state;
            peach.SwitchToStarSprite();
        }
コード例 #6
0
 public void SetChosen()
 {
     state = GlobalDefines.StarState.Chosen;
     //change sprite to blue
     starSprite.spriteName = blueStarPath;
     starSprite.MakePixelPerfect();
     //stop shine
     shineLogic.StopShine();
 }
コード例 #7
0
        virtual public void SetSuccess()
        {
            state = StarState.Success;

            if (legionData == null)
            {
                War.starManager.getPanel.Open(starConfig);
            }
        }
コード例 #8
0
ファイル: Star.cs プロジェクト: Qommon/GGJ2021
 /// <summary>
 /// 玩家吃星星
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="star">The star.</param>
 public void EatStar(GameObject player)
 {
     if (m_State == StarState.InBody)
     {
         return;
     }
     owner   = player.gameObject;
     target  = null;
     m_State = StarState.InBody;
     gameObject.SetActive(false);
 }
コード例 #9
0
 public void SetLinked()
 {
     state = GlobalDefines.StarState.Linked;
     //change sprite to yellow
     starSprite.spriteName = yellowStarPath;
     starSprite.MakePixelPerfect();
     //start to shine
     shineSprite.spriteName = yellowStarPath;
     shineSprite.MakePixelPerfect();
     shineLogic.StartShine();
 }
コード例 #10
0
 public void SetNormal()
 {
     state = StarState.Normal;
     //change sprite to yellow
     starSprite.spriteName = yellowStarPath;
     starSprite.MakePixelPerfect();
     //start to shine
     shineSprite.spriteName = yellowStarPath;
     shineSprite.MakePixelPerfect();
     shineLogic.StartShine();
 }
コード例 #11
0
 public StarStateChangedEventArgs(StarState current)
 {
     if (current == StarState.On)
     {
         this.OldState = StarState.Off;
         this.NewState = StarState.On;
     }
     else
     {
         this.OldState = StarState.On;
         this.NewState = StarState.Off;
     }
 }
コード例 #12
0
ファイル: Star.cs プロジェクト: Qommon/GGJ2021
    /// <summary>
    /// 玩家吐星星
    /// </summary>
    public void VomitStar(GameObject target)
    {
        if (m_State != StarState.InBody)
        {
            return;
        }
        gameObject.SetActive(true);
        this.target = target.transform;
        Vector3 moveDir = (target.transform.position - owner.transform.position).normalized;

        transform.position = owner.transform.position + moveDir * 0.5f;
        m_State            = StarState.Flying;
        owner = null;
    }
コード例 #13
0
        private static void OnStateChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            Star star = obj as Star;

            if (star != null)
            {
                StarState newState = (StarState)e.NewValue;

                //// set the fill based on the state
                star.StarFill = (newState == StarState.On) ? star.OnColor : star.OffColor;

                //// raise state change event
                star.OnStateChanged(new StarStateChangedEventArgs(star.State));
            }
        }
コード例 #14
0
ファイル: BasicMachine.cs プロジェクト: jennydvr/ColorWars
        public BasicMachine(Character character)
            : base(character)
        {
            // States
            StarState star = new StarState(character);
            EvadeState evade = new EvadeState(character);
            DeadState die = new DeadState(character);
            ChaseLifeState chase = new ChaseLifeState(character);

            // Add states
            this.states.Add(star);
            this.states.Add(evade);
            this.states.Add(die);
            this.states.Add(chase);

            this.initialState = this.currentState = star;
        }
コード例 #15
0
    public void SetState(StarState state)
    {
        this.starstate = state;
        switch (this.starstate)
        {
        case StarState.On:
            star.Frequency = 0.1f;
            star.Magnitude = 0.2f * velocity;
            star.Speed     = 5;
            break;

        case StarState.Off:
            star.Frequency = 0f;
            star.Magnitude = 0f * velocity;
            star.Speed     = 0;
            break;
        }
    }
コード例 #16
0
ファイル: Star.xaml.cs プロジェクト: priyanr/MyShuttle
        private static void OnStateChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            Star star = obj as Star;

            if (star != null)
            {
                StarState newState = (StarState)e.NewValue;
                if (newState == StarState.Off)
                {
                    star.OffStar.Visibility = Visibility.Visible;
                    star.OnStar.Visibility  = Visibility.Collapsed;
                }
                else
                {
                    star.OffStar.Visibility = Visibility.Collapsed;
                    star.OnStar.Visibility  = Visibility.Visible;
                }
            }
        }
コード例 #17
0
ファイル: Terminal.cs プロジェクト: calumgrant/slurp
        public Terminal Repeat(Range r)
        {
            IAutomaton seq = DFA.EmptyState.Instance;

            for (int i = 0; i < r.Start.Value; ++i)
            {
                seq = DFA.SeqState.Create(automaton, seq);
            }

            if (r.End.IsFromEnd)
            {
                seq = DFA.SeqState.Create(seq, StarState.Create(automaton));
            }
            else
            {
                for (int i = r.Start.Value; i < r.End.Value; ++i)
                {
                    seq = DFA.SeqState.Create(seq, DFA.OrState.Create(DFA.EmptyState.Instance, automaton));
                }
            }

            return(new Terminal(seq));
        }
コード例 #18
0
ファイル: Star.cs プロジェクト: Qommon/GGJ2021
 private void Start()
 {
     m_State = StarState.Idle;
 }
コード例 #19
0
ファイル: Star.xaml.cs プロジェクト: Saroko-dnd/My_DZ
 public StarStateChangedEventArgs(StarState current)
 {
     if (current == StarState.On)
     {
         this.OldState = StarState.Off;
         this.NewState = StarState.On;
     }
     else
     {
         this.OldState = StarState.On;
         this.NewState = StarState.Off;
     }
 }