Beispiel #1
0
    public void CreateRole(int ID)
    {
        myRole = PhotonNetwork.Instantiate("Darkman Solider", Random.onUnitSphere * 5f, Quaternion.identity, 0);
        if (ID == 0)
        {
            playersInfo.myID = PhotonNetwork.room.playerCount;
            GameObject myPlayer = GameObject.Find("Player" + PhotonNetwork.room.playerCount.ToString());
            myRole.transform.parent = myPlayer.transform;

            myPhotonView          = myPlayer.GetComponent <PhotonView>();
            myPhotonView.observed = myRole.GetComponent <NetworkController>();
        }
        playersInfo.alive[ID] = true;


        //AddTag(myPhotonView);
        if (myPhotonView.isMine)
        {
            TP_Animator   playerAnimator   = myRole.GetComponent <TP_Animator>();
            TP_Motor      playerMotor      = myRole.GetComponent <TP_Motor>();
            TP_Controller playerController = myRole.GetComponent <TP_Controller>();
            TP_Info       playerInfo       = myRole.GetComponent <TP_Info>();
            playerAnimator.enabled   = true;
            playerMotor.enabled      = true;
            playerController.enabled = true;
            playerInfo.enabled       = true;
        }
    }
Beispiel #2
0
    void OnAllScripts()
    {
        playerMotor     = GetComponent <TP_Motor>();
        playerAnimator  = GetComponent <TP_Animator>();
        playerInfo      = GetComponent <TP_Info>();
        gameObject.name = gameObject.name + photonView.viewID;

        /*playerCamera = transform.FindChild("Camera").gameObject;// transform.FindChild("Camera").gameObject;
         * playerAttack = transform.FindChild("AttackRangeCol").gameObject;
         * if(photonView.isMine)
         * {
         *      playerCamera.SetActive(true);
         *      playerAttack.SetActive(true);
         *      playerCamera.transform.parent = transform.FindChild("targetLookAt").transform;
         *      playerController.OnPlayerAttack();
         *      playerAnimator.OnPlayerAttack();
         * }
         * else
         * {
         *      playerCamera.gameObject.SetActive(false);
         *      playerController.OnPlayerAttack();
         *      playerAnimator.OnPlayerAttack();
         *      playerAttack.gameObject.SetActive(true);
         * }
         * playerController.SetIsLocalPlayer(photonView.isMine);*/
    }
 // Use this for initialization
 void Start()
 {
     player = GetComponent <TP_Animator> ();
     layer  = LayerMask.GetMask("Monster");
     pe     = GetComponent <person>();
     anim   = GetComponent <Animator> ();
 }
Beispiel #4
0
    }                                                                   // Property holds the animation state.

    #endregion

    #region UNITY_FUNCTIONS

    // Use this for initialization
    void Awake()
    {
        if (instance != this)
        {
            instance = this;
        }

        anim = GetComponent <Animation>();
    }
Beispiel #5
0
 void Awake()
 {
     myTransform      = transform;
     playerController = GetComponent <TP_Controller>();
     playerAnimator   = GetComponent <TP_Animator>();
     playerInfo       = GetComponent <TP_Info>();
     islocked         = false;
     SnapToLand       = false;
 }
Beispiel #6
0
    void Start()
    {
        _instance = this;
        anim      = GetComponent <Animation>();

        if (anim == null)
        {
            Debug.Log("Error: you need to set an Animation on the character!");
        }
    }
    }                                                       // Property holds the animation state.

    #endregion

    #region UNITY_FUNCTIONS

    // Use this for initialization
    void Awake()
    {
        if (instance != this)
        {
            instance = this;
        }

        //anim = GetComponent<Animation>();
        animator = GetComponent <Animator>();
        State    = CharacterState.Idle;
        data     = GameObject.Find("Scripts").GetComponent <Data>();
        // brushflow = GameObject.FindGameObjectWithTag("Brushflow");
    }
Beispiel #8
0
 void Awake()
 {
     Instance         = this;
     CC               = gameObject.GetComponent <CharacterController>();
     playerInfo       = GetComponent <TP_Info>();
     playerController = GetComponent <TP_Controller>();
     playerAnimator   = GetComponent <TP_Animator>();
     myTransform      = transform;
     myPos            = myTransform.position;
     isAlignCamera    = true;
     //JumpSpeed = 400f;
     Gravity          = 500f;
     TerminalVelocity = 1000f;
 }
Beispiel #9
0
    void Awake()
    {
        IsRunning           = true;
        CharacterController = GetComponent("CharacterController") as CharacterController;
        playerAnimator      = GetComponent <TP_Animator>();
        playerMotor         = GetComponent <TP_Motor>();
        playerInfo          = GetComponent <TP_Info>();
        roomMenu            = GameObject.FindGameObjectWithTag("RoomMenu").GetComponent <InRoom_Menu>();

        myPhotonView = GetComponent <PhotonView>();
        Instance     = this;

        UselightSourceTimer = 0;

        buffSkillType = new TP_Animator.BuffSkillType[2];
    }
Beispiel #10
0
 public void Dizzy(TP_Animator player, bool dizzy)
 {
     if (dizzy)
     {
         player.Dizzy();
         if (player.Mode == TP_Animator.CharacterMode.Skilling)
         {
             player.Mode = TP_Animator.CharacterMode.None;
             player.playerController.SkillType = 0;
         }
     }
     else
     {
         if (player.State != TP_Animator.CharacterState.Dead)
         {
             player.State = TP_Animator.CharacterState.Idle;
         }
     }
 }
Beispiel #11
0
 public void Freeze(TP_Animator player, bool freeze)
 {
     if (freeze)
     {
         player.Freeze();
         if (player.Mode == TP_Animator.CharacterMode.Skilling)
         {
             player.Mode = TP_Animator.CharacterMode.None;
             player.playerController.SkillType = 0;
         }
     }
     else
     {
         if (player.State != TP_Animator.CharacterState.Dead)
         {
             player.State = TP_Animator.CharacterState.Idle;
             player.Idle();
         }
     }
 }
 void Awake()
 {
     //   so when calling the variables or methods of this class from other script,
     Instance = this;					//    we can refer to this instance.
     avatarAnimator = GetComponentInChildren<Animator> ();
 }
Beispiel #13
0
 void Awake()
 {
     Instance = this;
 }
 // Use this for initialization
 void Start()
 {
     ta     = GameObject.FindGameObjectWithTag("Player").GetComponent <TP_Animator>();
     upitem = new item();
     gameObject.transform.FindChild("up").GetComponent <UIButton>().isEnabled = false;
 }
Beispiel #15
0
 // Use this for initialization
 void Start()
 {
     ta = GameObject.FindGameObjectWithTag("Player").GetComponent <TP_Animator>();
 }
Beispiel #16
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];
    }
 void Awake()
 {
     Instance = this;
 }
 void Awake()                                                //   so when calling the variables or methods of this class from other script,
 {
     Instance       = this;                                  //    we can refer to this instance.
     avatarAnimator = GetComponentInChildren <Animator> ();
 }