示例#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();
 }
        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();
 }
 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;
    }
        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
        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
        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
        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
 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;
     }
 }