Exemplo n.º 1
0
 public ResponseTalkState(string Sender, string Receiver, TalkState TalkState)
     : base()
 {
     Code  = (int)CodeMessage.CATalkAnswer;
     From  = Sender;
     To    = Receiver;
     State = (int)TalkState;
 }
Exemplo n.º 2
0
 private void callPanel1_OnOfferAnswer(string To, TalkState Answer)
 {
     ChatClient.RequestTalkState(Server, Nickname, To, Answer);
     if (Answer == TalkState.Adopt)
     {
         UdpChatClient.Start(UdpServer);
     }
     SetLogText("Call with " + To + " is " + ResponseTalkState.TalkStateString(Answer));
 }
Exemplo n.º 3
0
	void Awake() {
		mat = GetComponent<Renderer>().material;

		idleState = new IdleState(this);
		moveState = new MoveState(this);
		talkState = new TalkState(this);
		loveState = new LoveState(this);

		currentState = moveState;
	}
Exemplo n.º 4
0
    internal void Talk(string name, TalkState actionState)
    {
        AvatarController controller = getController(name);

        if (controller == null)
        {
            return;
        }
        controller.DoTalking(actionState);
        StartCoroutine(React(name, actionState));
    }
Exemplo n.º 5
0
    void Awake()
    {
        mat = GetComponent <Renderer>().material;

        idleState = new IdleState(this);
        moveState = new MoveState(this);
        talkState = new TalkState(this);
        loveState = new LoveState(this);

        currentState = moveState;
    }
Exemplo n.º 6
0
 // 初期化
 public void ResetData()
 {
     _state            = TalkState.OFF;
     _talkText.text    = "";
     _textCount        = 0;
     _textMessageIndex = 0;
     _speechBalloon.gameObject.SetActive(false);
     _talkText.gameObject.SetActive(false);
     _isOneMessage = false;
     _textSpeed    = _defTextSpeed;
 }
Exemplo n.º 7
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        TalkState selected = (TalkState)target;

        if (GUILayout.Button("This State's TalkData"))
        {
            selected.talkDataSet = DialogDataMgr.GetTalkDataForEditing(selected.talkDataNumber);
        }
    }
Exemplo n.º 8
0
        public static string TalkStateString(TalkState State)
        {
            switch (State)
            {
            case TalkState.Adopt: return("addopted");

            case TalkState.Busy: return("busy");

            case TalkState.Reject: return("reject");

            default: return("unknown");
            }
        }
Exemplo n.º 9
0
    public void Act(Tutor tutor, IMovement movement)
    {
        string s1 = getFirstMovementString(movement), s2;

        if (movement is MovementWithState)
        {
            s2 = getSecondMovementString((MovementWithState)movement);
            s1 = string.Concat(s1, "_", s2);
        }
        else if (movement is MovementWithTarget)
        {
            s2 = getSecondMovementString((MovementWithTarget)movement);
            s1 = string.Concat(s1, "_", s2);
        }
        else
        {
            Debug.Log(String.Format("\"{0}\" is not a valid action.", s1));
            return;
        }

        try // NOD
        {
            NodState actionState = getStateType <NodState>(s1);
            avatarManager.Nod(tutor.Name, actionState);
        }
        catch (ArgumentException)
        {
            try // GAZE
            {
                GazeState actionState = getStateType <GazeState>(s1);
                avatarManager.Gaze(tutor.Name, actionState);
            }
            catch (ArgumentException)
            {
                try // TALK
                {
                    TalkState actionState = getStateType <TalkState>(s1);
                    avatarManager.Talk(tutor.Name, actionState);
                }
                catch (ArgumentException ae)
                {
                    Debug.Log(ae.Message);
                }
            }
        }
    }
Exemplo n.º 10
0
    // reaction subroutine for talk actions
    IEnumerator React(string name, TalkState actionState)
    {
        float delay = 0.5f;

        yield return(new WaitForSeconds(delay));

        if (actionState.Equals(TalkState.TALK_START))
        {
            AvatarController partnerController = getPartnerController(name);
            partnerController.isListening(true);
            partnerController.DoGazing(GazeState.GAZEAT_PARTNER);
        }
        if (actionState.Equals(TalkState.TALK_END))
        {
            AvatarController partnerController = getPartnerController(name);
            partnerController.isListening(false);
            partnerController.DoNodding(NodState.NOD_END);
            partnerController.DoGazing(GazeState.GAZEBACK_PARTNER);
        }
    }
Exemplo n.º 11
0
    public void DoTalking(TalkState talkState)
    {
        if (talkState == TalkState.TALK_START)
        {
//            storedMood = animator.GetInteger("Mood");
//            storedMoodIntensity = animator.GetFloat("Mood Intensity");
            if (ApproachNeutral)
            {
                SetMood(EmotionalState.NEUTRAL, 0.0f);
            }
            if (ApproachLowerIntensity)
            {
                if (BubbleSystemUtility.CheckCoroutine(ref corrotina))
                {
                    StopCoroutine(corrotina);
                }

                corrotina = MoodTransition(animator.GetFloat("Mood Intensity"), animator.GetFloat("Desired Intensity") * 0.5f, 1.0f);
                StartCoroutine(corrotina);
            }
            //SetMood((EmotionalState)storedMood, (storedMoodIntensity / parameters.getMoodDampenerValue())*0.5f, 1.0f);
        }
        else
        {
            if (ApproachNeutral || ApproachLowerIntensity)
            {
                if (BubbleSystemUtility.CheckCoroutine(ref corrotina))
                {
                    StopCoroutine(corrotina);
                }
                corrotina = MoodTransition(animator.GetFloat("Mood Intensity"), animator.GetFloat("Mood Intensity") / 0.5f, 1.0f);
                StartCoroutine(corrotina);
            }

            //SetMood((EmotionalState)storedMood, storedMoodIntensity / parameters.getMoodDampenerValue(), 1.0f);
        }

        animator.SetInteger("Talk State", (int)talkState);
        animator.SetTrigger("Talk");
    }
Exemplo n.º 12
0
        /// <summary>
        /// Event handler for OnTalkState event
        /// </summary>
        public void OnTalkState(string From, TalkState TalkState)
        {
            if (From != TalkWith)
            {
                return;                   // Not allowed client
            }
            switch (TalkState)
            {
            case TalkState.Adopt:
                State  = CallState.Talk;
                Status = "Connection OK";
                break;

            case TalkState.Busy:
                State  = CallState.None;
                Status = "User " + From + " is busy";
                break;

            case TalkState.Reject:
                State  = CallState.None;
                Status = "User " + From + " reject call offer";
                break;
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// 设置对话状态
 /// </summary>
 /// <param name="_talkState"></param>
 public void SetTalkState(TalkState _talkState)
 {
     talkState = _talkState;
 }
Exemplo n.º 14
0
 private void callPanel1_OnOfferAnswer(string To, TalkState Answer)
 {
     ChatClient.RequestTalkState(Server, Nickname, To, Answer);
     if(Answer == TalkState.Adopt) UdpChatClient.Start(UdpServer);
     SetLogText("Call with " + To + " is " + ResponseTalkState.TalkStateString(Answer));
 }
Exemplo n.º 15
0
 /// <summary>
 /// Send answer talk state
 /// </summary>
 public void RequestTalkState(IPEndPoint Server, string Sender, string Receiver, TalkState state)
 {
     Msg("Request talk is " + ResponseTalkState.TalkStateString(state));
     ResponseTalkState resp = new ResponseTalkState(Sender, Receiver, state);
     SendRequest(Server, resp.GetBytes());
 }
Exemplo n.º 16
0
    public override AbstractState Update()
    {
        List<survivorAI> characters = FindsurvivorAIsInSight ();

        if (characters.Count == 0)
            return this; //We have nothing to do, our next state is out current states

        //We have to deal with the character that is getting close to our base

        float random = Random.value;
        if (random >= 0f && random <= 0.6f) {
            TalkState talk = new TalkState(survivorAI);
            talk.Parent = this;
            talk.Enemy = characters.First ();
            return talk;

        } else if(random >= 0.6f && random <= 0.8f)
        {
            FightState fight = new FightState(survivorAI);
            fight.Parent = this;
            fight.Enemy = characters.First();
            return fight;
        } else
        {
            RunState run = new RunState(survivorAI);
            run.Parent = this;
            run.Enemy = characters.First();
            return run;
        }
    }
Exemplo n.º 17
0
    public AbstractState checkSight()
    {
        List<survivorAI> characters = FindsurvivorAIsInSight ();
        if (characters.Count == 0){
            //Debug.Log("do Search running!" + (Time.fixedTime - startSearch) );
            //RunState run = new RunState();
            //run.Parent = this;
            //run.survivorAI = this.survivorAI;
            //return run; //We have nothing to do, our next state is out current states

            Mover2 m = survivorAI.GetComponent<Mover2> ();

            if(m.found == true || (Time.fixedTime - startSearch) > 5.0f)
            {
                DayState run = new DayState(survivorAI);
                return run;
            }

            return this;
        }

        //We have to deal with the character that is getting close to the searcher

        float random = Random.value;
        if (random >= 0f && random <= 0.6f) {
            TalkState talk = new TalkState(survivorAI);
            talk.Parent = this;
            talk.Enemy = characters.First ();
            return talk;

        } else if(random >= 0.6f && random <= 0.8f)
        {
            FightState fight = new FightState(survivorAI);
            fight.Parent = this;
            fight.Enemy = characters.First();
            return fight;
        } else
        {
            RunState run = new RunState(survivorAI);
            run.Parent = this;
            run.Enemy = characters.First();
            return run;
        }
    }
Exemplo n.º 18
0
        /// <summary>
        /// Send answer talk state
        /// </summary>
        public void RequestTalkState(IPEndPoint Server, string Sender, string Receiver, TalkState state)
        {
            Msg("Request talk is " + ResponseTalkState.TalkStateString(state));
            ResponseTalkState resp = new ResponseTalkState(Sender, Receiver, state);

            SendRequest(Server, resp.GetBytes());
        }
Exemplo n.º 19
0
    public override bool EventUpData()
    {
        // アイコンを非表示に
        if (_icon != null)
        {
            _icon.gameObject.SetActive(false);
        }
        // 吹き出しと文字の表示
        _speechBalloon.gameObject.SetActive(true);
        _talkText.gameObject.SetActive(true);

        _state = TalkState.ON;
        // 文字をすべて表示していない場合
        if (!_isOneMessage)
        {
            // 経過時間で1文字ずつ出していく
            _textSpeed -= Time.deltaTime;

            // 文字をすべて表示していない場合
            if (_textMessageList[_textMessageIndex].Length > _textCount)
            {
                if (_textSpeed <= 0)
                {
                    // 一文字追加
                    _talkText.text += _textMessageList[_textMessageIndex][_textCount];
                    // 現在の文字数を増やす
                    _textCount++;
                    // 時間の初期化
                    _textSpeed = _defTextSpeed;

                    // 全部の表示が終わったら
                    if (_textCount >= _textMessageList[_textMessageIndex].Length)
                    {
                        // キー入力で一回の会話を
                        if (Input.GetButtonDown("Jump"))
                        {
                            // 次の会話の表示フラグをtrueにする
                            _isOneMessage = true;
                        }
                    }
                }
            }
            // キー入力があった場合、文字を全部表示させる
            if (Input.GetButtonDown("Jump"))
            {
                _talkText.text += _textMessageList[_textMessageIndex].Substring(_textCount);
                _isOneMessage   = true;
            }
        }
        else
        {
            // 次の会話に移る
            _textMessageIndex++;
            // 吹き出し内の文字を消す
            _talkText.text = "";
            _textCount     = 0;
            _textSpeed     = _defTextSpeed;

            // すべての会話が終わった
            if (_textMessageIndex >= _textMessageList.Count)
            {
                ResetData();
                if (_icon != null)
                {
                    _icon.gameObject.SetActive(true);
                }

                // 会話終了にtrueを返す
                return(true);
            }
            else
            {
                _isOneMessage = false;
            }
        }

        // 会話が終了しなければfalseを返す
        return(false);
    }
Exemplo n.º 20
0
        /// <summary>
        /// Event handler for OnTalkState event
        /// </summary>
        public void OnTalkState(string From, TalkState TalkState)
        {
            if (From != TalkWith) return; // Not allowed client

            switch (TalkState)
            {
                case TalkState.Adopt:
                    State = CallState.Talk;
                    Status = "Connection OK";
                    break;

                case TalkState.Busy:
                    State = CallState.None;
                    Status = "User " + From + " is busy";
                    break;

                case TalkState.Reject:
                    State = CallState.None;
                    Status = "User " + From + " reject call offer";
                    break;
            }
        }
Exemplo n.º 21
0
 public static string TalkStateString(TalkState State)
 {
     switch (State)
     {
         case TalkState.Adopt: return "addopted";
         case TalkState.Busy: return "busy";
         case TalkState.Reject: return "reject";
         default: return "unknown";
     }
 }
Exemplo n.º 22
0
 public ResponseTalkState(string Sender, string Receiver, TalkState TalkState)
     : base()
 {
     Code = (int)CodeMessage.CATalkAnswer;
     From = Sender;
     To = Receiver;
     State = (int)TalkState;
 }