示例#1
0
 public void AddOneIncToEstate(estate whereToAdd)
 {
     counter[estate.fight]--;
     counter[estate.jump]--;
     counter[estate.resist]--;
     counter[estate.stand]--;
     counter[estate.walk]--;
     if (actual == whereToAdd)
     {
         if (counter[actual] < counter[second] + 5)
         {
             counter[actual] += 2;
         }
     }
     else
     {
         counter[whereToAdd] += 2;
         if (counter[whereToAdd] > counter[second])
         {
             second = whereToAdd;
         }
         if (counter[whereToAdd] > counter[actual] + 5)
         {
             second = actual;
             actual = whereToAdd;
         }
     }
 }
示例#2
0
    void Start()
    {
        transitions = new Dictionary <Focusswitch, estate>
        {
            { new Focusswitch(estate.wander, eaction.spot), estate.chase },
            { new Focusswitch(estate.wander, eaction.lose), estate.wander },
            { new Focusswitch(estate.wander, eaction.inrange), estate.attack },
            { new Focusswitch(estate.wander, eaction.earshot), estate.chase },

            { new Focusswitch(estate.chase, eaction.inrange), estate.attack },
            { new Focusswitch(estate.chase, eaction.lose), estate.wander },
            { new Focusswitch(estate.chase, eaction.spot), estate.chase },
            { new Focusswitch(estate.chase, eaction.earshot), estate.chase },

            { new Focusswitch(estate.attack, eaction.spot), estate.chase },
            { new Focusswitch(estate.attack, eaction.inrange), estate.attack },
            { new Focusswitch(estate.attack, eaction.lose), estate.wander },
            { new Focusswitch(estate.attack, eaction.earshot), estate.attack },
        };
        funcs = new Dictionary <estate, Action>
        {
            { estate.attack, new Action(attack) },
            { estate.chase, new Action(chase) },
            { estate.wander, new Action(wander) },
        };
        anim   = transform.GetChild(0).GetComponent <Animator> ();
        cont   = GetComponent <CharacterController> ();
        state  = estate.wander;
        player = GameObject.FindGameObjectWithTag("Player").transform;
        point  = transform.FindChild("point");
        //trash = GameObject.Find ("trash").transform;
        StartCoroutine("hunt", .05f);
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        _grounded = Physics2D.OverlapCircle(_groundCheck.position, _groundedRadius, _whatIsGround);

        if (_isIn)
        {
            estate?toChange = null;
            if (_playerRigibody.position.x <= transform.position.x)
            {
                if (Mathf.Abs(_playerRigibody.velocity.x) > 3.5)
                {
                    toChange = estate.fight;
                }
                if (Mathf.Abs(_playerRigibody.velocity.y) > 0)
                {
                    toChange = estate.jump;
                }
                if (_anim.GetBool("isPunchLeft") || _anim.GetBool("isPunchRight") || _anim.GetBool("isKickLeft") || _anim.GetBool("isKickRight"))
                {
                    toChange = estate.resist;
                }
                if (toChange.HasValue)
                {
                    _actualInterpretor = toChange.Value;
                }
            }
        }
    }
    public void SetDialogueState(int state)
    {
        m_GameState = (estate)state;
        switch (m_GameState)
        {
        case estate.gameStart:
            m_CurrentLine = GAME_START;
            m_EndLine     = POST_GAME - 1;
            break;

        case estate.postGame:
            m_CurrentLine = POST_GAME;
            m_EndLine     = BOSS_SEEN - 1;
            break;

        case estate.bossSeen:
            m_CurrentLine = BOSS_SEEN;
            m_EndLine     = LOST_BOSS - 1;
            break;

        case estate.LostBoss:
            m_CurrentLine = LOST_BOSS;
            m_EndLine     = WIN - 1;
            break;

        case estate.Win:
            m_CurrentLine = WIN;
            m_EndLine     = m_TextLines.Length - 1;
            break;

        default:
            Debug.Log("Should not see this");
            break;
        }
    }
示例#5
0
        public phoneCall(string cId, string callernum, string callednum, string disp, string extdata, string startstate)
        {
            callId = cId;

            callerNumber  = callernum;
            calledNumber  = callednum;
            display       = disp;
            attachedData  = extdata;
            currEnumState = (estate)Enum.Parse(typeof(estate), startstate);
        }
示例#6
0
 private IAStats(estate baseState)
 {
     counter = new Dictionary <estate, int>();
     counter.Add(estate.fight, 0);
     counter.Add(estate.jump, 0);
     counter.Add(estate.resist, 0);
     counter.Add(estate.stand, 0);
     counter.Add(estate.walk, 0);
     actual = baseState;
     second = baseState;
 }
示例#7
0
 void AddStat(estate resultEstate)
 {
     Debug.Log(resultEstate);
     _actualIA.AddOneIncToEstate(resultEstate);
     //estate? toChange = null;
     //if (Mathf.Abs(Player.velocity.x) > 3.5)
     //    toChange = estate.fight;
     //if (Mathf.Abs(Player.velocity.y) > 0)
     //    toChange = estate.jump;
     //if (playerAnimator.GetBool("isPunchLeft") || playerAnimator.GetBool("isPunchRight") || playerAnimator.GetBool("isKickLeft") || playerAnimator.GetBool("isKickRight"))
     //    toChange = estate.resist;
     //Debug.Log(toChange);
     ////if (toChange.HasValue)
     ////    AddOneIncToEstate(toChange.Value);
 }
 void AddStat(estate resultEstate)
 {
     Debug.Log(resultEstate);
     _actualIA.AddOneIncToEstate(resultEstate);
     //estate? toChange = null;
     //if (Mathf.Abs(Player.velocity.x) > 3.5)
     //    toChange = estate.fight;
     //if (Mathf.Abs(Player.velocity.y) > 0)
     //    toChange = estate.jump;
     //if (playerAnimator.GetBool("isPunchLeft") || playerAnimator.GetBool("isPunchRight") || playerAnimator.GetBool("isKickLeft") || playerAnimator.GetBool("isKickRight"))
     //    toChange = estate.resist;
     //Debug.Log(toChange);
     ////if (toChange.HasValue)
     ////    AddOneIncToEstate(toChange.Value);
 }
示例#9
0
    public void switchfocus(eaction act)
    {
        Focusswitch focus = new Focusswitch(state, act);
        estate      next  = estate.wander;

        //Debug.Log (state+" : "+act+" | "+transitions);
        if (!(transitions == null || transitions.TryGetValue(focus, out next)))
        {
            Debug.Log("Invalid transition: " + state + " -> " + act);
            return;
        }
        if (next == state)        //too many prints, combine above done testing
        {
            return;
        }
        //Debug.Log (transform.name+" sw: "+state+" ("+act+") -> "+next);
        state = next;
    }
    // Update is called once per frame
    void Update()
    {
        _grounded = Physics2D.OverlapCircle(_groundCheck.position, _groundedRadius, _whatIsGround);

        if (_isIn)
        {
            estate? toChange = null;
            if (_playerRigibody.position.x <= transform.position.x)
            {
                if (Mathf.Abs(_playerRigibody.velocity.x) > 3.5)
                    toChange = estate.fight;
                if (Mathf.Abs(_playerRigibody.velocity.y) > 0)
                    toChange = estate.jump;
                if (_anim.GetBool("isPunchLeft") || _anim.GetBool("isPunchRight") || _anim.GetBool("isKickLeft") || _anim.GetBool("isKickRight"))
                    toChange = estate.resist;
                if (toChange.HasValue)
                    _actualInterpretor = toChange.Value;
            }
        }
    }
示例#11
0
 public void setState(string newstate)
 {
     currEnumState = (estate)Enum.Parse(typeof(estate), newstate);
 }
示例#12
0
 public Focusswitch(estate s, eaction a)
 {
     state  = s;
     action = a;
 }