Ejemplo n.º 1
0
    protected override IEnumerator ActivityDuringDurationTime()
    {
        DS = DogState.GO;
        SkillSoundEffect("SkillEffect_Dog", 2f);

        return(base.ActivityDuringDurationTime());
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (findMe.target == null)
        {
            state         = DogState.DEFAULT;
            findMe.target = player.transform;
        }

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (state != DogState.DEFAULT)
            {
                return;
            }
            else
            {
                state = DogState.SEARCH;
                Debug.Log("search");
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (state != DogState.DEFAULT)
            {
                return;
            }
            else
            {
                state = DogState.FETCH;
                Debug.Log("fetch");
            }
        }
    }
Ejemplo n.º 3
0
    void StopHere()
    {
        //NavMeshAgentを止める
        agent.isStopped = true;

        State = DogState.Idle;
    }
Ejemplo n.º 4
0
    public void SetCurrentState(DogState state)
    {
        this.currentState = state;
        switch (state)
        {
        case DogState.barking:
            isBarking   = true;
            isPatroling = false;
            isIdle      = false;
            break;

        case DogState.idle:
            isBarking   = false;
            isPatroling = false;
            isIdle      = true;
            break;

        case DogState.patroling:
            isBarking   = false;
            isPatroling = true;
            isIdle      = false;
            break;

        case DogState.dead:
            isDead = true;
            animator.SetTrigger(isDeadParam);
            break;
        }

        animator.SetBool(isPatrolingParam, isPatroling);
        animator.SetBool(isIdleParam, isIdle);
        animator.SetBool(isBarkingParam, isBarking);
    }
Ejemplo n.º 5
0
        private void EnterState(DogState state)
        {
            switch (currentState)
            {
            case DogState.EYEBROW:
                ContentManager.GetSound("bow").Play();
                currnetTime = 0;
                break;

            case DogState.SLIDE_IN_TO_START:
                dog.SetDrawBoxPos(dog.getDrawBox().X, ContentManager.SCREEN_HEIGHT - dog.getDrawBox().Height - ContentManager.FLOOR_HEIGHT + 10);
                dog.SetEffect(SpriteEffects.FlipHorizontally);
                eyebrow.SetEffect(SpriteEffects.FlipHorizontally);
                EYE_BROW_OFFSET = new Vector2(dog.getDrawBox().Width - 255 - eyebrow.getDrawBox().Width, 43);
                break;

            case DogState.POOPING:
                Pooping(0);
                break;

            case DogState.SLIDE_IN:
                EYE_BROW_OFFSET = new Vector2(255, 43);
                dog.SetEffect(SpriteEffects.None);
                eyebrow.SetEffect(SpriteEffects.None);
                dog.SetDrawBoxPos(ContentManager.SCREEN_WIDTH, ContentManager.SCREEN_HEIGHT - 450);
                break;
            }
        }
Ejemplo n.º 6
0
    public void MovePlayed(DogState move)
    {
        if (!movePlayed)  // only one move per move!
        {
            movePlayed = true;

            if (move != level.CurrentDogState())
            {
                moveGrade = MoveGrade.Wrong;
            }
            else
            {
                float timeDifference = Mathf.Abs(Time.time - nextBeatTime);
                moveGrade = MoveGrade.Perfect;
                while (timeDifference > thresholdTimes[(int)moveGrade])
                {
                    moveGrade++;
                }
            }

            if ((int)moveGrade >= (int)MoveGrade.Miss)
            {
                success = false;
            }

            gradeText.StartText(moveGrade);
        }
    }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        uac      = GetComponent <UnityArmatureComponent>();
        dogSleep = transform.Find("dog_sleep").gameObject;
        dogCatch = transform.Find("dog_catch").gameObject;
        //        uac.flipX = true;
        t = transform.DOMove(new Vector3(2, 0.12f, 1), 6).SetAutoKill(false).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.Linear);
        Tweener rotate = transform.DORotate(new Vector3(0, 0, 0), 0.01f).SetAutoKill(false);

        State = DogState.Move;

        t.onStepComplete += () =>
        {
            if (rotate.IsBackwards())
            {
                rotate.PlayForward();
            }
            else
            {
                rotate.PlayBackwards();
            }
        };
        t.PlayForward();
        GlobalDispatcher.Instance.AddListener(GlobalEvent.OnDogCatch, OnEventDispach);
//        MTRunner.Instance.StartRunner(Wait(5));
    }
Ejemplo n.º 8
0
    // Update is called once per frame
    void Update()
    {
        time += Time.deltaTime;
        if (!isCatch)
        {
            if (time >= Random.Range(1, 3) * 5)
            {
                State = DogState.Sleep;
                t.Pause();

                if (time > Random.Range(1, 3) * 15)
                {
                    t.PlayForward();
                    State = DogState.Move;
                    time  = 0;
                }
            }
        }
        else
        {
            State = DogState.Catch;
            t.Pause();
            if (time > Random.Range(3, 4))
            {
                isCatch = false;
                time    = 0;
            }
        }
    }
Ejemplo n.º 9
0
    public IEnumerator MoveOutDelay()
    {
        yield return(new WaitForSeconds(1f));//

        guardScript.GoHome();
        dogState = DogState.moveOut;
    }
Ejemplo n.º 10
0
 void Start()
 {
     lerp          = GetComponent <AILerp>();
     findMe        = GetComponent <AIDestinationSetter>();
     state         = DogState.DEFAULT;
     player        = GameObject.FindGameObjectWithTag("Player");
     findMe.target = player.transform;
 }
Ejemplo n.º 11
0
    public void DoFollow()
    {
        dogState = DogState.FOLLOW_VISIBLE_VICTIM;
        runDog.SetActive(true);
        walkDog.SetActive(false);

        // alertSound.Play();
    }
Ejemplo n.º 12
0
 public Dog()
 {
     dog             = new Box(ContentManager.SCREEN_WIDTH, ContentManager.SCREEN_HEIGHT - 450, 715, 758, Color.White, "dog");
     eyebrow         = new Box(0, 0, 44, 25, Color.White, "eyebrow");
     EYE_BROW_OFFSET = new Vector2(255, 43);
     currentState    = DogState.IDLE;
     setNextState(DogState.SLIDE_IN);
 }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     player   = GameObject.FindGameObjectWithTag("Player");
     agent    = GetComponent <NavMeshAgent>();
     state    = DogState.Idle;
     anim     = GetComponent <Animator>();
     stateNow = state;
 }
Ejemplo n.º 14
0
 private void OnFollowEnter()
 {
     navAgent.isStopped = false;
     state           = DogState.Follow;
     subState        = DogSubState.FollowPath;
     startLookAtTime = float.MaxValue;
     animator.PlayWalk();
     Repath(followOffset);
 }
Ejemplo n.º 15
0
 public void ResetGame()
 {
     this.locationState = LocationStates.NotStarted;
     this.dogState      = DogState.Ignored;
     this.capeState     = CapeState.Down;
     this.talkingToGirl = false;
     this.fallingInLove = 0;
     SchoolLocation.Instance.Reset();
 }
Ejemplo n.º 16
0
 private void LeaveState(DogState state)
 {
     switch (currentState)
     {
     case DogState.EYEBROW:
         eye_brow_delta = 0;
         break;
     }
 }
Ejemplo n.º 17
0
 void GotoNextPoint()
 {
     State = DogState.Move;
     //NavMeshAgentのストップの解除
     agent.isStopped = false;
     //CentralPointの位置にPosXとPosZを足す
     pos = central.position;
     //NavMeshAgentに目標地点を設定する
     agent.destination = pos;
 }
Ejemplo n.º 18
0
    private void OnPatrolEnter()
    {
        navAgent.isStopped = false;
        state    = DogState.Patrol;
        subState = DogSubState.PatrolGotoInteractable;
        Vector3 targetPos = needsObjects[currentNeedsObjectIndex].transform.position;

        navAgent.SetDestination(targetPos);
        animator.PlayWalk();
    }
Ejemplo n.º 19
0
    // Start is called before the first frame update
    void Start()
    {
        faceRight = true;
        isFollow  = true;
        isSit     = false;
        state     = DogState.FOLLOW;

        anim   = GetComponent <Animator>();
        rb     = GetComponent <Rigidbody2D>();
        target = GameObject.FindGameObjectWithTag("Player").transform;
    }
Ejemplo n.º 20
0
 public void MoveHorizontal(int xPos)
 {
     MoveTo(new Vector2(xPos, Position.Y));
     if (xPos < Position.X)
     {
         CurrentState = DogState.WalkingLeft;
     }
     else if(xPos > Position.X)
     {
         CurrentState = DogState.WalkingRight;
     }
 }
Ejemplo n.º 21
0
    private void OnLeadEnter()
    {
        navAgent.isStopped = false;
        state           = DogState.Lead;
        subState        = DogSubState.GoToOwner;
        startLookAtTime = float.MaxValue;
        animator.PlayWalk();
        Vector3 direction = (needsFilling.transform.position - owner.position).normalized;

        direction *= goToFarmerDistance;
        Repath(direction);
    }
Ejemplo n.º 22
0
 void MoveToTarget()
 {
     transform.position = Vector2.MoveTowards(transform.position, new Vector2(target.position.x, transform.position.y), speed * Time.deltaTime);
     //Debug.Log(Vector2.Distance(transform.position, new Vector2(target.position.x, transform.position.y)));
     if (Vector2.Distance(transform.position, new Vector2(target.position.x, transform.position.y)) < 0.05f)
     {
         Debug.Log(state);
         isFollow = false;
         anim.SetBool("Follow", false);
         state = DogState.STAND;
     }
 }
Ejemplo n.º 23
0
 private void SetNextTargetPosition()
 {
     float pos = Position.X;
     while (Math.Abs(pos - Position.X) < 100)
     {
         pos = rand.Next(50, 750 - (int)Size.X);
     }
     targetPosition = new Vector2(pos, Position.Y);
     startPosition = Position;
     stateDuration = (targetPosition - startPosition).Length() / Speed;
     state = DogState.Moving;
 }
Ejemplo n.º 24
0
    void Start()
    {
        state           = DogState.Idle;
        animator        = GetComponent <Animator>();
        soundController = GetComponent <DogSoundController>();
        stateDuration   = 0.4f; // seconds
        timeAtNewState  = 0.0f;
        StartExtra();

        Timer timer = GameObject.Find("MainController").GetComponent <Timer>();

        timer.AddSubscriber(this);
    }
Ejemplo n.º 25
0
    void Update()
    {
        // is it time to idle again?! //
        animator.SetInteger("DogState", (int)state);

        if (state != DogState.Idle)
        {
            if (stateTimeOver())
            {
                state = DogState.Idle;
            }
        }
    }
Ejemplo n.º 26
0
    public void StateButtonPressed(DogState buttonState)
    {
        if (!level.IsLeading())
        {
            timeAtNewState = Time.time;
            state          = buttonState;
            if (state == DogState.Bark)
            {
                soundController.Bark();
            }

            verifier.MovePlayed(buttonState);
        }
    }
Ejemplo n.º 27
0
    IEnumerator getCoroutineForState(DogState state)
    {
        switch (state)
        {
        case DogState.Wandering:
            return(wander());

        case DogState.Idle:
            return(null);

        default:
            return(null);
        }
    }
Ejemplo n.º 28
0
 void switchToState(DogState state)
 {
     if (state != this.currentState)
     {
         if (currentStateRoutine != null)
         {
             StopCoroutine(currentStateRoutine);
         }
         currentStateRoutine = getCoroutineForState(state);
         if (currentStateRoutine != null)
         {
             StartCoroutine(currentStateRoutine);
         }
         this.currentState = state;
     }
 }
    void CalculateWeight()
    {
        this.losingWeight = this.hunger <= 25;

        if (losingWeight)
        {
            int curr_state = (int)this.dogState < Enum.GetNames(typeof(DogState)).Length - 1 ? (int)this.dogState + 1 : (int)DogState.Hell;
            this.dogState = (DogState)curr_state;
            print("state actual = " + this.dogState.ToString());
        }

        if (this.hunger <= 0)
        {
            GameController.current.Ending("dog hunger");
        }
    }
Ejemplo n.º 30
0
    private void GoStraight()
    {
        float betangle = Vector3.Angle(Owner.HQ.transform.position, this.transform.position);

        if (betangle > 90)
        {
            DS = DogState.BACK;
        }
        if (DS == DogState.GO)
        {
            SkillParent.transform.Rotate(new Vector3(-speed * GameTime.FrameRate_60_Time, 0, 0));
        }
        else if (DS == DogState.BACK)
        {
            SkillParent.transform.Rotate(new Vector3(speed * GameTime.FrameRate_60_Time, 0, 0));
        }
    }
Ejemplo n.º 31
0
    void CheckPlayerFromRay()
    {
        RaycastHit2D hitInfo = Physics2D.Raycast(transform.position, new Vector2(direction, 0), distanceToPlayer, whatIsPlayer);

        if (hitInfo.collider != null)
        {
            isFollow = false;
            state    = DogState.STAND;
            anim.SetBool("Follow", isFollow);
        }
        else
        {
            isFollow = true;
            state    = DogState.FOLLOW;
            anim.SetBool("Follow", isFollow);
        }
    }
Ejemplo n.º 32
0
    // Update is called once per frame
    void Update()
    {
        agent.SetDestination(player.transform.position);

        if (agent.remainingDistance > agent.stoppingDistance)
        {
            state = DogState.Walk;
        }
        else
        {
            state = DogState.Attack;
        }
        //如果状态改变
        if (stateNow != state)
        {
            stateNow = state;
            ChangeState();
        }
    }
Ejemplo n.º 33
0
 void SetNextState()
 {
     switch (state)
     {
         case DogState.WaitingToMove:
             SetNextTargetPosition();
             break;
         case DogState.Moving:
             state = DogState.WaitingToDrop;
             stateDuration = DropDelay;
             break;
         case DogState.WaitingToDrop:
             if (DropEgg != null) DropEgg(this, null);
             state = DogState.WaitingToMove;
             stateDuration = 0;
             break;
     }
     timeSinceStateChange = 0;
 }
Ejemplo n.º 34
0
 public void Start()
 {
     state = DogState.WaitingToMove;
     SetNextState();
 }
Ejemplo n.º 35
0
        public override void Update(GameTime gameTime)
        {
            if (gameTime.TotalGameTime.TotalSeconds >= _bark.TimeFinished && CurrentState.Equals(DogState.Barking))
            {
                CurrentState = DogState.Sitting;
            }

            ChangeTexture();
            if (HasReachedDestination)
            {
                Sit();
            }
            base.Update(gameTime);
        }
Ejemplo n.º 36
0
 public void Sit()
 {
     CurrentState = DogState.Sitting;
 }
Ejemplo n.º 37
0
    void UpdateState()
    {
        Vector3 prevLaneOffset = currentLane.GetOffset();

        switch (currentState)
        {
            case DogState.CHASE:
                currentLane = player.currentLane;
                break;

            case DogState.LUNGE:
                // Take care of warning period
                if (delayTimer < LUNGE_DELAY) {
                    delayTimer += Time.deltaTime;
                    warningSprite.SetActive(true);
                }
                else {
                    warningSprite.SetActive(false);
                    lungeTimer++;

                    // If dog has finished lunging, make it go back to chasing
                    if (lungeTimer > MAX_LUNGE_TIMER)
                    {
                        lungeTimer = 0;
                        delayTimer = 0.0f;
                        currentState = DogState.CHASE;
                    }
                }
                break;
        }

        transform.position = new Vector3
        (
            transform.position.x,
            currentLane.GetY() + 0.1f,
            transform.position.z
        ) - prevLaneOffset + currentLane.GetOffset();
    }
Ejemplo n.º 38
0
 /// <summary>
 /// Method to let the dog bark
 /// </summary>
 public void Bark(GameTime gameTime)
 {
     _currentFrame = 0;
     CurrentState = DogState.Barking;
     _bark.Play(gameTime);
 }
Ejemplo n.º 39
0
 public void Stop()
 {
     currentState = DogState.EATING;
 }