コード例 #1
0
 void UpdateCatcherState()
 {
     if (!hasCapsule)
     {
         currentPortions.Clear();
         currentCatcherState = CatcherState.EMPTY;
         //skinnedMesh.material.color = Color.clear;
     }
     else if (currentPortions.Count == 0)
     {
         currentCatcherState = CatcherState.EMPTY_CAPSULE;
     }
     else if (currentPortions.Count == 1)
     {
         currentCatcherState = CatcherState.FILLED_1;
     }
     else if (currentPortions.Count == 2)
     {
         currentCatcherState = CatcherState.FILLED_2;
     }
     else if (currentPortions.Count == 3)
     {
         currentCatcherState = CatcherState.FILLED_3;
     }
     else if (currentPortions.Count == 4)
     {
         currentCatcherState = CatcherState.FILLED_4;
     }
     else if (currentPortions.Count == 5)
     {
         currentCatcherState = CatcherState.FULL_CAPSULE;
     }
 }
コード例 #2
0
 public void Start()
 {
     handUpLocal      = transform.InverseTransformVector(hand.transform.up);
     handUpWorld      = hand.transform.up;
     state            = CatcherState.None;
     handOriginOffset = hand.transform.localPosition;
     oriLocalUp       = transform.InverseTransformVector(hand.transform.up);
 }
コード例 #3
0
ファイル: CrushedEgg.cs プロジェクト: andreymir/eggsss
        public void Initialize(Texture2D[] texture, Vector2 position, CatcherState state, TimeSpan gameTime)
        {
            elapsedTime = 0;
            currentFrame = 0;
            Texture = texture;
            Position = position;
            State = state;

            Active = true;
        }
コード例 #4
0
ファイル: Catcher.cs プロジェクト: andreymir/eggsss
        public void Initialize(Texture2D[] texture, Vector2 position, CatcherState state)
        {
            PlayerTexture = texture;

            Position = position;

            // Set the starting position of the player around the middle of thescreen and to the back
            State = state;

            // Set the player to be active
            Active = true;
        }
コード例 #5
0
 public void Caught(Mine mine = null)
 {
     if (state == CatcherState.Push)
     {
         if (mine != null)
         {
             temMine = mine;
             temMine.Caught(this);
             state = CatcherState.Caught;
         }
         else
         {
             state = CatcherState.Back;
         }
     }
 }
コード例 #6
0
        public void Back()
        {
            if (state == CatcherState.Back || state == CatcherState.Fly)
            {
                Debug.Log("Back");
                state = CatcherState.None;

                if (temMine != null)
                {
                    temMine.Collect(this);
                }

                if (parent != null)
                {
                    parent.CollectMine(temMine);
                }

                temMine = null;
            }
        }
コード例 #7
0
ファイル: Egg.cs プロジェクト: andreymir/eggsss
        public void Initialize(Rectangle window, Texture2D[] textures, SoundEffect[] soundEffects, CatcherState trayNumber, TimeSpan createTime, TimeSpan pace)
        {
            this.textures = textures;
            lastStepTime = createTime;
            this.soundEffects = soundEffects;
            Pace = pace;
            TrayNumber = trayNumber;

            switch (trayNumber)
            {
                case CatcherState.BottomLeft:
                case CatcherState.TopLeft:
                    stepDelta = new Vector2(25, 18);
                    break;
                case CatcherState.BottomRight:
                case CatcherState.TopRight:
                    stepDelta = new Vector2(-25, 18);
                    break;
            }

            switch (trayNumber)
            {
                case CatcherState.TopLeft:
                    Position = new Vector2(150, 270);
                    break;
                case CatcherState.TopRight:
                    Position = new Vector2(850, 270);
                    break;
                case CatcherState.BottomRight:
                    Position = new Vector2(900, 390);
                    break;
                case CatcherState.BottomLeft:
                    Position = new Vector2(100, 390);
                    break;
            }

            StepNumber = 0;
            Crushed = false;
        }
コード例 #8
0
ファイル: Catcher.cs プロジェクト: andreymir/eggsss
 public void Update(CatcherState state)
 {
     State = state;
 }
コード例 #9
0
ファイル: Game1.cs プロジェクト: andreymir/eggsss
        private void AddEgg(GameTime gameTime)
        {
            var egg = new Egg();
            var textureSet = eggTextures[random.Next(3)];
            var pace = TimeSpan.FromMilliseconds(1000);
            CatcherState trayNumber;
            do
            {
                trayNumber = (CatcherState)random.Next(1, 4);
            }
            while (trayNumber == prevTrayNumber);

            egg.Initialize(GraphicsDevice.Viewport.TitleSafeArea,
                textureSet, moveSounds, trayNumber, gameTime.TotalGameTime, pace);
            eggs.Add(egg);
            prevTrayNumber = trayNumber;
        }
コード例 #10
0
ファイル: Game1.cs プロジェクト: andreymir/eggsss
 private void AddCrushedEgg(GameTime gameTime, CatcherState position)
 {
     var crushedEgg = new CrushedEgg();
     crushedEgg.Initialize(crushedEggTextures, playerPosition, position, gameTime.TotalGameTime);
     crushedEggs.Add(crushedEgg);
 }
コード例 #11
0
        public void Push()
        {
            state = CatcherState.Push;

            velocity = hand.transform.up * pushSpeed;
        }
コード例 #12
0
        public void UpdateHand()
        {
            parent.flyTo = Vector3.zero;

            if (state == CatcherState.None)
            {
                hand.transform.position = handOrigiPosWorld;

                toHand = hand.transform.up;
            }
            else if (state == CatcherState.Push)
            {
                hand.transform.position = preHandPos + velocity * Time.deltaTime;

                toHand            = (hand.transform.position - handOrigiPosWorld);
                hand.transform.up = toHand.normalized;
                //rope.transform.up = toHand.normalized;

                //rope.size = new Vector2(0.2f, toHand.magnitude);

                if (toHand.magnitude > maxRopeLength)
                {
                    Caught();
                }
            }
            else if (state == CatcherState.Caught)
            {
                state = CatcherState.Fly;
            }
            else if (state == CatcherState.Fly)
            {
                toHand = temMine.transform.position - handOrigiPosWorld;


                hand.transform.position = temMine.transform.position;
                //Vector3 backHand = - toHand * backSpeed * Time.deltaTime;
                //backHand = Vector3.ClampMagnitude(backHand, pushSpeed * 2f);

                //toHand *= (1f - backSpeed * Time.deltaTime);
                //hand.transform.position = handOrigiPosWorld + toHand;

                Vector3 flyTo = toHand * flySpeed;

                parent.flyTo = flyTo;

                hand.transform.up = toHand.normalized;

                if (toHand.magnitude < backOffset)
                {
                    Back();
                }
            }
            if (state == CatcherState.Back)
            {
                toHand = preHandPos - handOrigiPosWorld;

                Vector3 backHand = -toHand * backSpeed * Time.deltaTime;
                backHand = Vector3.ClampMagnitude(backHand, pushSpeed * 2f);

                toHand *= (1f - backSpeed * Time.deltaTime);
                hand.transform.position = handOrigiPosWorld + toHand;

                hand.transform.up = toHand.normalized;

                if (toHand.magnitude < backOffset)
                {
                    Back();
                }
            }

            realHandVelocity = (hand.transform.position - preHandPos) / Time.deltaTime;
            preHandPos       = hand.transform.position;
        }