Esempio n. 1
0
    public GameObject GetCurrentMesh()
    {
        CatState catState = this.GetComponent <CatState>();

        if (catState != null && chaserMesh != null && chasedMesh != null)
        {
            if (catState.currentState == eCatState.CHASER)
            {
                return(chaserMesh);
            }
            else
            {
                return(chasedMesh);
            }
        }
        return(null);
    }
Esempio n. 2
0
        public void initialized(ContentManager content, int widthMapPos, int heightMapPos, string texturePath, string texturePathDead, int x, int y, int h, int w, int hCut, int wCut)
        {
            //Set Position
            m_catPos    = new Rectangle(x, y, w, h);
            m_catAnim   = CatAnim.Frame1;
            m_catState  = CatState.Life;
            m_animStart = false;

            m_mapPosX = widthMapPos;
            m_mapPosY = heightMapPos;

            //Set Rectangle
            m_catRectangle = new Rectangle(0, 0, wCut, hCut);

            //Load Texture
            m_catTexture = content.Load <Texture2D>(texturePath);
            m_catDead    = content.Load <Texture2D>(texturePathDead);
        }
Esempio n. 3
0
        public void Physiology()
        {
            do
            {
                var interval = 1000;
                Thread.Sleep((int)interval);

                if (_energy >= 70 && _energy < 100)
                {
                    _state = CatState.Fed;
                }
                if (_energy <= 60 && _state == CatState.Fed)
                {
                    CatHungy?.Invoke();
                    _state = CatState.Hungry;
                }
                _energy--;
            } while (_energy != 0);
        }
Esempio n. 4
0
    public void setState(CatState newState)
    {
        switch (newState)
        {
        case CatState.exhausted:
            icon.enabled = true;
            icon.sprite  = exhausted;
            break;

        case CatState.zooming:
            icon.enabled = true;
            icon.sprite  = zoom;
            break;

        default:
            icon.enabled = false;
            break;
        }
    }
Esempio n. 5
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(catState);


        if (health <= 0)
        {
            Destroy(gameObject);
            playerEnergy.WinEnergy();
            gameManager.score = gameManager.score + deadpoints;
        }
        distance = Vector2.Distance(transform.position, target.transform.position);

        if (distance <= 3)
        {
            catState = CatState.ATTACK;
        }
        if (touchPlayer)
        {
            catState = CatState.FLEE;
        }

        switch (catState)
        {
        case CatState.FOLLOW:
            transform.position = Vector2.MoveTowards(transform.position, target.transform.position, moveSpeed * Time.deltaTime);
            CatAnimation.SetFloat("VelocityX", target.transform.position.x);
            break;

        case CatState.ATTACK:
            moveSpeed          = 8;
            transform.position = Vector2.MoveTowards(transform.position, target.transform.position, moveSpeed * Time.deltaTime);
            break;

        case CatState.FLEE:
            transform.position = Vector2.MoveTowards(transform.position, spawnflee.transform.position, moveSpeed * Time.deltaTime);
            cat.isTrigger      = true;
            //render.flipX = touchPlayer;
            CatAnimation.SetBool("Touch", touchPlayer == true);
            break;
        }
    }
Esempio n. 6
0
        public void Tick(float deltaTime)
        {
            switch (_state)
            {
            case CatState.LookingForFood:
                LookForFood(deltaTime);
                GetHungrier(deltaTime);
                break;

            case CatState.Resting:
                GetHungrier(deltaTime);
                _urgeToEat = _hunger;
                if (_urgeToEat > .6f)
                {
                    _state = CatState.LookingForFood;
                }

                break;

            case CatState.GoingToEatFood:
                if (_targetFood.IsEaten)
                {
                    _state = CatState.Resting;
                }

                if (Vector2.Distance(Position, _desiredPosition) < _closeEnoughDistance)
                {
                    Debug.Log("Ate Food!");
                    // monch!
                    _hunger    = 0f;
                    _urgeToEat = 0f;
                    _state     = CatState.Resting;
                    _gameView.DeleteFood(_targetFood.Guid);
                }
                Position = Vector2.MoveTowards(Position, _desiredPosition, _speed * deltaTime);
                GetHungrier(deltaTime);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 7
0
        //Methods
        public bool TouchInputKill(Vector2 screenScale, TouchCollection touchPanelState)
        {
            if (m_animStart)
            {
                //Collision
                foreach (TouchLocation tl in touchPanelState)
                {
                    if (tl.State == TouchLocationState.Pressed)
                    {
                        if (tl.Position.X > m_catPos.X / screenScale.X && tl.Position.X < m_catPos.X / screenScale.X + m_catRectangle.Width / screenScale.X && /* X */
                            tl.Position.Y > m_catPos.Y / screenScale.Y && tl.Position.Y < m_catPos.Y / screenScale.Y + m_catRectangle.Height / screenScale.Y /* Y */)
                        {
                            if (m_catState == CatState.Life)
                            {
                                m_catState = CatState.DeadAnim;
                                m_catAnim  = CatAnim.Frame1;

                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }

            return(false);
        }
Esempio n. 8
0
    void Walk()
    {
        Vector3 dir = movingPoint.transform.position - transform.position;

        float distance = Vector3.Distance(transform.position, movingPoint.transform.position);

        Debug.Log("distance=" + distance);

        if (distance < 1.0f)
        {
            state = CatState.Idle;
            anim.SetBool("Idle_", true);
            return;
        }

        dir.Normalize();

        transform.forward  = Vector3.Lerp(transform.forward, dir, Time.deltaTime);
        transform.position = Vector3.Lerp(transform.position, movingPoint.transform.position, 0.2f * Time.deltaTime);
    }
Esempio n. 9
0
        private void LookForFood(float deltaTime)
        {
            var nearbyFood = _gameView.GetNearbyFood(Position, _sensoryRange);

            if (nearbyFood != null)
            {
                Debug.Log("Found Food!");
                _state           = CatState.GoingToEatFood;
                _desiredPosition = nearbyFood.Position;
                _targetFood      = nearbyFood;
                return;
            }

            if (Vector2.Distance(Position, _desiredPosition) < _closeEnoughDistance)
            {
                _desiredPosition = _gameView.GetRandomMapPosition();
            }

            Position = Vector2.MoveTowards(Position, _desiredPosition, _speed * deltaTime);
        }
Esempio n. 10
0
 private void GetCode()
 {
     if (Input.anyKeyDown)
     {
         string currentKey = Input.inputString;
         if (currentKey == code[cheatIndex])
         {
             cheatIndex++;
             if (cheatIndex == code.Length)
             {
                 hasCheated = true;
                 catState   = CatState.trex;
             }
         }
         else
         {
             cheatIndex = 0;
         }
     }
 }
Esempio n. 11
0
    private void OnStateEnded(CatStateType state)
    {
        if (state == CatStateType.DoAction)
        {
            if (Random.Range(0f, 1f) < letsCrazyChance || IsCrazy == true)
            {
                currentState = catStateDict[CatStateType.Crazy];
            }
            else
            {
                currentState = catStateDict[CatStateType.Walk];
            }
        }

        if (state == CatStateType.Walk || state == CatStateType.Crazy)
        {
            currentState = catStateDict[CatStateType.DoAction];
        }

        currentState.EnterState();
    }
Esempio n. 12
0
        //UPDATE
        public void Update(GameTime gameTime, TouchCollection touchPanelState, Vector2 screenScale)
        {
            //Animation
            if (m_animStart)
            {
                m_elapsed = (float)gameTime.ElapsedGameTime.TotalMilliseconds; //Timer
                m_timer  -= (int)m_elapsed;

                if (m_timer <= -70) //Duration
                {
                    if (m_catAnim == CatAnim.Frame1)
                    {
                        m_catAnim = CatAnim.Frame2; //Frame 2
                    }
                    else if (m_catAnim == CatAnim.Frame2)
                    {
                        m_catAnim = CatAnim.Frame3; //Frame 3
                    }
                    else if (m_catAnim == CatAnim.Frame3)
                    {
                        m_catAnim = CatAnim.Frame4; //Frame 4
                    }
                    else if (m_catAnim == CatAnim.Frame4)
                    {
                        m_catAnim = CatAnim.Frame5; //Frame 5
                    }
                    else if (m_catAnim == CatAnim.Frame5)
                    {
                        m_catAnim = CatAnim.Frame6; //Frame 6
                    }
                    else if (m_catAnim == CatAnim.Frame6 && m_catState == CatState.DeadAnim)
                    {
                        m_catState = CatState.Dead;
                    }

                    m_timer = 0; //Reset Timer
                }
            }
        }
Esempio n. 13
0
    void OnMouseDrag()
    {
        Vector3 pos = Input.mousePosition;
        float   dis = Vector3.Distance(mousePoint, pos);

        if (dis > 20)
        {
            count++;
        }

        if (count == 5)
        {
            if (GameManager.Instance.petFeel == PetFeeling.Love)
            {
                state = CatState.Nail;
                anim.SetBool("Nail_", true);
            }

            if (GameManager.Instance.petFeel == PetFeeling.Happy)
            {
                state = CatState.Wriggle;
                anim.SetBool("Wriggle_", true);
            }

            if (GameManager.Instance.petFeel == PetFeeling.SoSo)
            {
                state = CatState.Cry;
                anim.SetBool("Cry_", true);
            }

            if (GameManager.Instance.petFeel == PetFeeling.Cry)
            {
                state = CatState.Crycry;
                anim.SetBool("Crycry_", true);
            }
        }
    }
Esempio n. 14
0
    // Update is called once per frame
    void Update()
    {
        state.time += Time.deltaTime;

        if (state.time > state.dur)
        {
            state = state.next();
            if (state.current == "Meow")
            {
                meowSound.Play();
            }
            if (state.current == "Walk")
            {
                rb.velocity = new Vector3(-0.5f + UnityEngine.Random.value, 0, -0.5f + UnityEngine.Random.value).normalized;

                transform.forward = rb.velocity;
            }
            else
            {
                rb.velocity = Vector3.zero;
            }
            rb.angularVelocity = Vector3.zero;
        }
    }
Esempio n. 15
0
    // Update is called once per frame
    void Update()
    {
        CatState catState = this.GetComponent <CatState>();

        if (catState != null && chaserMesh != null && chasedMesh != null)
        {
            if (catState.currentState == eCatState.CHASER)
            {
                if (!chaserMesh.activeInHierarchy)
                {
                    chaserMesh.SetActive(true);
                    chasedMesh.SetActive(false);
                }
            }
            else if (catState.currentState == eCatState.CHASED)
            {
                if (!chasedMesh.activeInHierarchy)
                {
                    chaserMesh.SetActive(false);
                    chasedMesh.SetActive(true);
                }
            }
        }
    }
Esempio n. 16
0
    private IEnumerator GetDownFromPerch()
    {
        PerchInformations _infosStart;

        switch (catState)
        {
        case CatState.LeftPerch:
            _infosStart = leftPerchInfos;
            catState    = CatState.RightPerch;
            break;

        case CatState.RightPerch:
            _infosStart = rightPerchInfos;
            catState    = CatState.LeftPerch;
            break;

        default:
            yield break;
        }
        SetAnimationState((int)CatAnimationState.Jump);
        yield return(new WaitForSeconds(.2f));

        float _delta  = 0;
        float _ratio  = 0;
        float _height = Mathf.Abs(_infosStart.PerchPosition.y - _infosStart.LandingPosition.y);

        while (_delta < LANDING_TIME)
        {
            _ratio             = _delta / LANDING_TIME;
            transform.position = new Vector3(Mathf.Lerp(_infosStart.PerchPosition.x, _infosStart.LandingPosition.x, _ratio), _infosStart.LandingCurve.Evaluate(_ratio) * _height, Mathf.Lerp(_infosStart.PerchPosition.z, _infosStart.LandingPosition.z, _ratio));
            yield return(null);

            _delta += Time.deltaTime;
        }
        movementCoroutine = StartCoroutine(MoveCat());
    }
Esempio n. 17
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // 통조림 먹기
        if (other.gameObject.tag.Equals("FishCan"))
        {
            if (Cat != CatState.Full && TempCat != CatState.Full)
            {                                    // 안배부른 상태일 때(TempCat은 상태가 Fall 상태일 때도 대비하여)
                if (CollObj != other.gameObject) // 중복되지 않을 때만
                {
                    CollObj = other.gameObject;
                    AddLife();
                    GetComponent <AudioSource>().Play();
                    Destroy(other.gameObject);
                }
                if (lifeCount >= lifeLimit)
                {
                    Cat     = CatState.Full;
                    TempCat = Cat;
                }
            } // if (Cat != CatState.Full && TempCat != CatState.Full)
        }

        // 우산 먹기
        if (other.gameObject.tag.Equals("Umbrella"))
        {
            if (CollObj != other.gameObject)
            {
                if (UmbrellaDirector.UmbState == Umbrella.Normal)   // 우산 가지고 있는 경우
                {
                    UmbrellaDirector UmbD = FindObjectOfType <UmbrellaDirector>();
                    UmbD.NewUmbrella();
                }

                CollObj = other.gameObject;
                Umb_Take_Sound.GetComponent <AudioSource>().Play();
                Destroy(other.gameObject);
                HasUmb = true;
                UmbrellaDirector.UmbState = Umbrella.Normal;
            }
        }

        // 세이브 포인트
        if (other.gameObject.tag.Equals("Respawn"))
        {
            if (CollObj != other.gameObject)
            {
                CollObj = other.gameObject;
                StageDirector.SavePoint = other.transform.position;

                // 스테이지
                if (other.gameObject.name.Contains("Stage1"))
                {
                    StageDirector.StageDir = Stage.Stage2;
                }
                else if (other.gameObject.name.Contains("Stage2"))
                {
                    StageDirector.StageDir = Stage.Stage3;
                }
                else if (other.gameObject.name.Contains("Stage3"))
                {
                    StageDirector.StageDir = Stage.Stage4;
                }
                Debug.Log(StageDirector.StageDir);

                // 깃발 연출
                other.GetComponent <SpriteRenderer>().sprite = Resources.Load("flag", typeof(Sprite)) as Sprite;
            }
        }

        // 도착
        if (other.gameObject.tag.Equals("Finish"))
        {
            if (CollObj != other.gameObject)
            {
                CollObj = other.gameObject;
                StageDirector.StageDir = Stage.GameEnd;

                // 스위치 연출
                other.GetComponent <SpriteRenderer>().sprite = Resources.Load("switch", typeof(Sprite)) as Sprite;
            }
        }
    } // void OnTriggerEnter2D(Collider2D other)
Esempio n. 18
0
    // Update is called once per frame
    void Update()
    {
        // 게임 엔드 화면에서는 못움직이게
        if (StageDirector.StageDir == Stage.GameEnd)
        {
            GetComponent <Animator>().enabled = false;
            return;
        }

        // 플레이어 속도
        float speedx = Mathf.Abs(this.rigid2D.velocity.x);

        // 좌우 이동
        int key = 0;

        if (Input.GetKey(KeyCode.RightArrow))
        {
            key = 1;
        }
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            key = -1;
        }

        // 움직이는 방향에 따라 이미지 반전
        if (key != 0)
        {
            transform.localScale = new Vector3(key, 1, 1);
        }

        // 점프한다.
        if (Input.GetKeyDown(KeyCode.Space) && rigid2D.velocity.y == 0 && Cat != CatState.Fall)
        {
            animator.SetTrigger("JumpTrigger");
            rigid2D.AddForce(transform.up * jumpForce);
        }

        // 스피드 제한
        if (speedx < maxWalkSpeed)
        {
            rigid2D.AddForce(transform.right * key * walkForce);
        }

        // 화면 벗어나지 못하게 막는 처리
        if (2.5f < transform.position.x)
        {
            transform.position = new Vector3(2.5f, transform.position.y, transform.position.z);
        }
        if (transform.position.x < -2.5f)
        {
            transform.position = new Vector3(-2.5f, transform.position.y, transform.position.z);
        }

        // 플레이어가 아래로 떨어질 때 상태 변화
        if (CameraController.CState == CameraState.InAir || CameraController.CState == CameraState.Top)
        {
            Vector3 CamPos = FindObjectOfType <CameraController>().transform.position;
            Vector3 CatPos = transform.position;
            Vector3 dir    = CatPos - CamPos;
            float   d      = dir.magnitude;
            if (d > 11.3f)      // 화면 밖으로 떨어질 때
            {
                if (HasUmb)     // 우산 있는 경우
                {
                    CameraController.CState = CameraState.Fall;
                    Cat = CatState.Fall;
                }
                else
                {
                    DelLife();
                    transform.position      = StageDirector.SavePoint; // 세이브 포인트로 이동하게 될 부분
                    CameraController.CState = CameraState.Bottom;      // 카메라 다시 세팅
                    Cat = CatState.Reborn;
                }
            } // if (d > 11.0f)      // 화면 밖으로 떨어질 때
        }     // if (CameraController.CState == CameraState.InAir)

        // 상태 변화 연출
        if (Cat == CatState.Reborn)
        {
            delta += Time.deltaTime;

            if (delta > (RebornTime / 5.0f) * 4)
            {
                GetComponent <SpriteRenderer>().color = RebornColor[0];
            }
            else if (delta > (RebornTime / 5.0f) * 3)
            {
                GetComponent <SpriteRenderer>().color = RebornColor[1];
            }
            else if (delta > (RebornTime / 5.0f) * 2)
            {
                GetComponent <SpriteRenderer>().color = RebornColor[0];
            }
            else if (delta > (RebornTime / 5.0f) * 1)
            {
                GetComponent <SpriteRenderer>().color = RebornColor[1];
            }
            else if (delta > RebornTime / 5.0f)
            {
                GetComponent <SpriteRenderer>().color = RebornColor[0];
            }

            if (delta > RebornTime)
            {
                GetComponent <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                Cat   = TempCat;
                delta = 0;
            }
        } // if (Cat == CatState.Reborn)
        else if (Cat == CatState.Walk)
        {
            animator.SetBool("IsFall", false);
            animator.SetBool("IsFull", false);
            ImFullImg.gameObject.SetActive(false);

            // 느리게 연출 해제
            Time.timeScale = 1.0f;
            GetComponent <Rigidbody2D>().gravityScale = 3;
        }
        else if (Cat == CatState.Full)
        {
            ImFullImg.gameObject.SetActive(true);
            animator.SetBool("IsFull", true);
        }
        else if (Cat == CatState.Fall)
        {
            ImFullImg.gameObject.SetActive(false);

            if (rigid2D.velocity.y != 0)    // 발이 허공에 있을 때
            {
                animator.SetBool("IsFall", true);

                // 느리게 연출
                Time.timeScale = 0.3f;
                GetComponent <Rigidbody2D>().gravityScale = 0.001f;
                rigid2D.AddForce(-transform.up * fallForce);
            }
            else
            {
                Cat = TempCat;
                animator.SetBool("IsFall", false);
                CameraController.CState = CameraState.InAir;

                // 느리게 연출 해제
                Time.timeScale = 1.0f;
                GetComponent <Rigidbody2D>().gravityScale = 3;
            }
        } // else if (Cat == CatState.Fall)

        // 플레이어 속도에 맞춰 애니메이션 속도를 바꾼다.
        if (rigid2D.velocity.y == 0)
        {
            animator.speed = speedx / 2.0f;
        }
        else
        {
            animator.speed = 1.0f;
        }
    } // void Update()
Esempio n. 19
0
 // Use this for initialization
 void Start()
 {
     state = CatState.Idle;
     anim  = gameObject.GetComponent <Animator>();
 }
Esempio n. 20
0
 public void die()
 {
     this.state = CatState.DYING;
 }
Esempio n. 21
0
    private void Update()
    {
        TrackState();

        if (meow_counter < meow_delay)
        {
            meow_counter += Time.deltaTime;
        }
        else
        {
            var chance = Random.Range(0, 101);
            if (chance < 33)
            {
                audio_controller.PlaySound("Meow 1");
            }
            if (chance >= 33 && chance < 66)
            {
                audio_controller.PlaySound("Meow 2");
            }
            if (chance >= 66 && chance < 100)
            {
                audio_controller.PlaySound("Meow 3");
            }

            meow_delay   = Random.Range(8, 26);
            meow_counter = 0;
        }

        if (time >= 1)
        {
            state.Cycle(this);

            time = 0;
        }

        if (time_until_next_pet > 0)
        {
            time_until_next_pet -= Time.deltaTime;
        }

        time += Time.deltaTime;

        if ((this.emotionality == "Hungry" ||
             this.emotionality == "Hungry and Tired") &&
            bowl.meal_object.activeSelf == true &&
            is_eating == false &&
            is_sleeping == false)
        {
            if (room.name != "Kitchen")
            {
                EnterRoom("Kitchen");
                Walk();

                if (Vector2.Distance(transform.position, waypoint.transform.position) < 0.2f)
                {
                    if (waypoint.type == WaypointType.Origin)
                    {
                        ChangeToRoom(waypoint.new_room);
                    }
                }

                return;
            }

            if (Vector2.Distance(transform.position, bowl.transform.position) < 0.1f)
            {
                state = new CatEating(animator, animations["Eating"]);
                Invoke("StopEating", bowl.meal.time_to_devour);

                model.ToggleCatEatingSounds(true);
                is_eating = true;
            }
            else
            {
                state = new CatWalking(animator, animations["Walking"]);
            }

            WalkTo(bowl.transform);
            return;
        }

        if (is_eating)
        {
            return;
        }

        if (this.emotionality == "Tired" &&
            room.IsLightsOn() == false &&
            is_sleeping == false &&
            Vector2.Distance(transform.position, waypoint.transform.position) < 0.2f)
        {
            state = new CatSleeping(animator, animations["Sleeping"]);

            StartCoroutine(notification_display.RemoveNotification(Mood.Tired, 0));
            notification_display.SendNotification(Mood.Sleeping);

            is_sleeping = true;

            Invoke("StopSleeping", 120);
        }

        if (is_sleeping)
        {
            return;
        }

        if (this.emotionality != "Tired" &&
            this.emotionality != "Hungry and Tired" &&
            this.emotionality != "Hungry" &&
            this.happiness < 40)
        {
            if (Vector2.Distance(transform.position, toy.transform.position) < 0.5f)
            {
                is_playing = true;

                model.ToggleCatPlayingSounds(true);
                state = new CatPlaying(animator, animations["Standing"]);
                notification_display.SendNotification(Mood.Playing);

                Invoke("StopPlaying", toy.time_to_play);
            }
            else
            {
                if (is_playing)
                {
                    StopPlaying();
                }
            }
        }

        if (is_playing)
        {
            return;
        }

        if (entering_new_room == false)
        {
            if (time_until_next_action <= 0)
            {
                time_until_next_action = UnityEngine.Random.Range(3, 8);
                waypoint = GetRandomWaypoint(false);
            }
            else
            {
                time_until_next_action -= Time.deltaTime;
            }
        }

        if (Vector2.Distance(transform.position, waypoint.transform.position) < 0.2f)
        {
            state = new CatStanding(animator, animations["Standing"]);

            if (entering_new_room == true)
            {
                entering_new_room = false;
            }

            if (waypoint.type == WaypointType.Origin)
            {
                ChangeToRoom(waypoint.new_room);
            }
        }
        else
        {
            state = new CatWalking(animator, animations["Walking"]);

            Walk();
        }
    }
Esempio n. 22
0
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (Director.GetInstance().playing)
        {
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                if (cat_state == CatState.MIDDLE)
                {
                    cat_state = CatState.RIGHT;
                }
                else if (cat_state == CatState.LEFT)
                {
                    cat_state = CatState.MIDDLE;
                }
                else
                {
                    cat_state = CatState.RIGHT;
                }
            }

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                if (cat_state == CatState.MIDDLE)
                {
                    cat_state = CatState.LEFT;
                }
                else if (cat_state == CatState.RIGHT)
                {
                    cat_state = CatState.MIDDLE;
                }
                else
                {
                    cat_state = CatState.LEFT;
                }
            }

            //for debug
            catx = cat.transform.position.x;
            //Debug.Log((cat.transform.position.x > -1.2f).ToString());

            //move cat
            if (cat_state == CatState.LEFT && cat.transform.position.x > -1.2f)
            {
                cat.transform.Translate(toLf * Time.deltaTime * 2.0f);
            }
            else if (cat_state == CatState.RIGHT && cat.transform.position.x < 1.2f)
            {
                cat.transform.Translate(toRg * Time.deltaTime * 2.0f);
            }
            else if (cat_state == CatState.MIDDLE)
            {
                if (cat.transform.position.x > 0)
                {
                    cat.transform.Translate(toLf * Time.deltaTime * 2.0f);
                }
                else if (cat.transform.position.x < 0)
                {
                    cat.transform.Translate(toRg * Time.deltaTime * 2.0f);
                }
            }
        }
        else
        {
            cat.SetActive(false);
            ani.ResetTrigger("Walk");
            ani.SetTrigger("Idle");
        }
    }
Esempio n. 23
0
 void setState(CatState newState)
 {
     currentState = newState;
     UpdateVisual();
 }
Esempio n. 24
0
 void CatAttack(InteractiveEntity target, CatAttackType attackType)
 {
     target.OnCatInteract(attackType);
     state = CatState.attack;
     timer = attackTime;
 }
Esempio n. 25
0
 private void InitializeState(CatState state)
 {
     catStateDict[state.State] = state;
     state.StateEndedEvent    += OnStateEnded;
     state.Initialize(student, destinations);
 }
Esempio n. 26
0
 public void SetState(CatState state)
 {
     _state = state;
 }
Esempio n. 27
0
 public CatContext(CatState catState)
 {
     _flavorText = "";
     _statusText = "";
     this.TransitionTo(catState);
 }
Esempio n. 28
0
 public void TransitionTo(CatState catState)
 {
     this.catState = catState;
     this.catState.SetContext(this);
 }
Esempio n. 29
0
 public void ExitBeLoved()
 {
     state = CatState.idle;
     NextActionDecide();
 }
Esempio n. 30
0
 public void init(float speedModifier, CatState ev)
 {
     segmentState = ev;//(RaceEvent)Random.Range(0, 3);
     time         = speedModifier;
 }