Beispiel #1
0
    private int CalculateMoveSpeed()
    {
        int movespeed;

        movespeed = playerInfo.GetAbility((int)AbilityName.MoveSpeed).CurValue;

        return(movespeed);
    }
Beispiel #2
0
    public void UpdateRoleInfo(TP_Info info)
    {
        int   curValue = 0;
        float maxValue = 0;

        for (int cnt = 0; cnt < roomUIInfo.Count; cnt++)
        {
            curValue = info.GetAbility(cnt).CurValue;
            roomUIInfoValue[cnt].text = curValue.ToString();

            if (cnt == 0)
            {
                maxValue = 200;
            }
            else if (cnt == 1)
            {
                maxValue  = 20;
                curValue -= 75;
            }
            else if (cnt == 2)
            {
                maxValue = 15;
            }
            else if (cnt == 3)
            {
                maxValue  = 30;
                curValue -= 100;
            }
            else if (cnt == 4)
            {
                maxValue = 100;
            }
            else if (cnt == 5)
            {
                maxValue  = 100;
                curValue -= 100;
            }
            else if (cnt == 6)
            {
                maxValue = 100;
            }

            roomUIInfo[cnt].value = (curValue / maxValue);
        }
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        CheckCanMove();

        CheckSkillState();

        TP_Animator.CharacterState lastState = playerAnimator.State;

        playerHealth = playerInfo.GetVital((int)VitalName.Health);

        aiRig.AI.WorkingMemory.SetItem("DyingHealth", (int)(playerHealth.MaxValue * 0.1f));
        aiRig.AI.WorkingMemory.SetItem("health", playerHealth.CurValue);
        if (playerInfo.Level != _level)
        {
            aiRig.AI.WorkingMemory.SetItem("level", playerInfo.Level);
        }
        if (_speed != playerInfo.GetAbility((int)(AbilityName.MoveSpeed)).CurValue)
        {
            _speed = playerInfo.GetAbility((int)(AbilityName.MoveSpeed)).CurValue;
            aiRig.AI.WorkingMemory.SetItem("forwardSpeed", _speed);
        }

        rayCastTest();

        _state  = aiRig.AI.WorkingMemory.GetItem <string>("state");
        _attack = aiRig.AI.WorkingMemory.GetItem <string>("attackWay");

        if (_canShopping != playerInfo.CanShopping)
        {
            _canShopping = playerInfo.CanShopping;
            aiRig.AI.WorkingMemory.SetItem("canShopping", _canShopping);
        }

        if (_atHome != aiRig.AI.WorkingMemory.GetItem <bool>("atHome"))
        {
            aiRig.AI.WorkingMemory.SetItem("atHome", _atHome);
        }
        if (_atEnemyHome != aiRig.AI.WorkingMemory.GetItem <bool>("atEnemy"))
        {
            aiRig.AI.WorkingMemory.SetItem("atEnemy", _atEnemyHome);
        }

        if (_state == "runningForward")
        {
            if (lastState != TP_Animator.CharacterState.KnockingDown && lastState != TP_Animator.CharacterState.StandingUp && playerAnimator.CanMove())
            {
                if (playerAnimator.MoveDirection != TP_Animator.Direction.Forward)
                {
                    playerAnimator.MoveDirection = TP_Animator.Direction.Forward;
                    playerAnimator.State         = TP_Animator.CharacterState.Running;
                }
            }
        }

        if (_state == "runningBack")
        {
            if (lastState != TP_Animator.CharacterState.KnockingDown && lastState != TP_Animator.CharacterState.StandingUp && playerAnimator.CanMove())
            {
                playerAnimator.MoveDirection = TP_Animator.Direction.Backward;
                playerAnimator.State         = TP_Animator.CharacterState.Running;
            }
        }

        if (_state == "StoreEnergy")
        {
            if (!aiRig.AI.WorkingMemory.ItemExists("storeEnergyTimer"))
            {
                aiRig.AI.WorkingMemory.SetItem("storeEnergyTimer", 0);
            }
            float SETimer = aiRig.AI.WorkingMemory.GetItem <float>("storeEnergyTimer");
            if (SETimer < 5)
            {
                SETimer += Time.deltaTime;
                aiRig.AI.WorkingMemory.SetItem("storeEnergyTimer", SETimer);
                playerController.EnergyStoreInput(0);
            }
            else
            {
                _state = "Idle";
                aiRig.AI.WorkingMemory.SetItem("Task", 0);
                aiRig.AI.WorkingMemory.RemoveItem("storeEnergyTimer");
                playerAnimator.EnergyStoreInput(1);
            }
        }

        if (_state != playerAnimator.State.ToString())
        {
            if (_state == "Dead")
            {
                playerAnimator.Die();
            }
            if (lastState == TP_Animator.CharacterState.KnockingDown && !playerAnimator.LockAnimating)
            {
                playerAnimator.StandUp();
            }

            if (lastState != TP_Animator.CharacterState.KnockingDown && lastState != TP_Animator.CharacterState.StandingUp && lastState != TP_Animator.CharacterState.EnergyStoring && playerAnimator.Mode != TP_Animator.CharacterMode.Skilling)
            {
                switch (_state)
                {
                case "Idle":
                    playerAnimator.MoveDirection = TP_Animator.Direction.Stationary;
                    playerAnimator.State         = TP_Animator.CharacterState.Idle;
                    break;
                }
            }
        }

        if (_attack == "MagicAttack")
        {
            if (!playerAnimator.LockAttacking && !playerAnimator.LockAnimating)
            {
                if (lastState != TP_Animator.CharacterState.KnockingDown && lastState != TP_Animator.CharacterState.StandingUp && lastState != TP_Animator.CharacterState.EnergyStoring)
                {
                    playerAnimator.LockAttacking = true;
                    playerController.MagicAttackInput(0);
                }
            }
        }
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        myTransform = transform;
        rayDistance = 0.6f;
        backRayObj  = false;
        rightRayObj = false;
        leftRayObj  = false;

        wildHarnesses = GameObject.Find("GameScript").GetComponent <Game_Manager>().WildHarnesses;

        playerController = GetComponent <TP_Controller>();
        playerAnimator   = GetComponent <TP_Animator>();
        playerInfo       = GetComponent <TP_Info>();
        playerHealth     = playerInfo.GetVital((int)VitalName.Health);
        PhotonView playerView = GetComponent <PhotonView>();

        if (playerView.isMine)
        {
            _owner = true;
        }
        else
        {
            _owner = false;
        }
        aiRig.AI.WorkingMemory.SetItem("owner", _owner);

        aiRig.AI.WorkingMemory.SetItem("changePosTimer", 0);
        aiRig.AI.WorkingMemory.SetItem("DyingHealth", (int)(playerHealth.MaxValue * 0.1f));
        aiRig.AI.WorkingMemory.SetItem("wild", _wild);
        aiRig.AI.WorkingMemory.SetItem("T", 0);
        aiRig.AI.WorkingMemory.SetItem("isChangingPos", false);
        _task           = 0;
        _level          = 1;
        _speed          = playerInfo.GetAbility((int)(AbilityName.MoveSpeed)).CurValue;
        _canShopping    = true;
        _needShopping   = true;
        _atHome         = false;
        _atEnemyHome    = false;
        _hasEnemy       = false;
        _canChangeState = true;
        _canUseSkill    = true;

        aiRig.AI.WorkingMemory.SetItem("canUseSkill", _canUseSkill);
        aiRig.AI.WorkingMemory.SetItem("hasEnemy", _hasEnemy);
        aiRig.AI.WorkingMemory.SetItem("canShopping", _canShopping);
        aiRig.AI.WorkingMemory.SetItem("needShopping", _needShopping);
        aiRig.AI.WorkingMemory.SetItem("forwardSpeed", _speed);
        aiRig.AI.WorkingMemory.SetItem("canUseLS", true);
        aiRig.AI.WorkingMemory.SetItem("SkillTimer", 0);
        aiRig.AI.WorkingMemory.SetItem("LSTimer", 0);
        aiRig.AI.WorkingMemory.SetItem("atHome", _atHome);
        aiRig.AI.WorkingMemory.SetItem("atEnemy", _atEnemyHome);
        aiRig.AI.WorkingMemory.SetItem("ready", false);
        aiRig.AI.WorkingMemory.SetItem("TaskNum", _task);
        aiRig.AI.WorkingMemory.SetItem("attackTar", AttackTarget);
        _state  = playerAnimator.State.ToString();
        _attack = "";
        aiRig.AI.WorkingMemory.SetItem("state", _state);
        aiRig.AI.WorkingMemory.SetItem("attackWay", _attack);

        _wPNdiecrtion = Vector3.zero;
        aiRig.AI.WorkingMemory.SetItem("WPNdiecrtion", _wPNdiecrtion);
        //_state = TP_Animator.CharacterState.None;
        isResetWild = false;
        aiRig.AI.WorkingMemory.SetItem("reset", isResetWild);

        skillState = new bool[5];
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        myTransform.GetComponent <NJGMapItem>().type = 8;
        if (type == MonsterType.monsterBoss)
        {
            myTransform.parent.GetComponent <WildTrigger>().MonsterBoss = myTransform;
            Land = myTransform.parent.gameObject;
            MonsterScript[] MS = myTransform.parent.GetComponentsInChildren <MonsterScript>();
            foreach (MonsterScript ms in MS)
            {
                if (ms.type == MonsterType.monster)
                {
                    minions.Add(ms);
                    ms.BossScript = this;
                }
            }
            Reset();
        }
        else if (type == MonsterType.monster)
        {
            int status = -(InRoom_Menu.SP.GetPlayerFromID(myTransform.GetComponent <PhotonView>().viewID).properties.Ai) % 3;
            if (status == 2)
            {
                Land = myTransform.parent.FindChild("Anchor1").gameObject;
            }
            else if (status == 0)
            {
                Land = myTransform.parent.FindChild("Anchor2").gameObject;
            }
        }
        aiRig.AI.WorkingMemory.SetItem("Land", Land);
        aiRig.AI.WorkingMemory.SetItem("faceTarget", myTransform.parent.GetComponent <WildTrigger>().FaceTarget);

        PhotonView playerView = GetComponent <PhotonView>();

        if (playerView.isMine)
        {
            _owner = true;
        }
        else
        {
            _owner = false;
        }
        aiRig.AI.WorkingMemory.SetItem("owner", _owner);

        _speed = playerInfo.GetAbility((int)(AbilityName.MoveSpeed)).CurValue;
        aiRig.AI.WorkingMemory.SetItem("forwardSpeed", _speed);

        aiRig.AI.WorkingMemory.SetItem("isLocked", islocked);

        _state = playerAnimator.State.ToString();
        aiRig.AI.WorkingMemory.SetItem("state", _state);
        aiRig.AI.WorkingMemory.SetItem("canAttack", _attack);
        inLand = true;
        aiRig.AI.WorkingMemory.SetItem("inLand", inLand);

        playerInfo.MeleeAttackDistance = 6;
        playerInfo.MeleeAttackAngle    = 0.83f;


        aiRig.AI.WorkingMemory.SetItem("recover", Recover);
    }