Esempio n. 1
0
    // Start is called before the first frame update
    void OnEnable()
    {
        pv = GetComponent <PhotonView>();
        if (!pv.IsMine)
        {
            this.enabled = false;
        }

        controller = GetComponent <GameCharController>();
        anim       = GetComponent <Animator>();

        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            joystick = GameObject.FindWithTag("Joystick").GetComponent <Joystick>();
            isMobile = true;
        }
        else
        {
            isMobile = false;
        }
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (controller == null)
        {
            Debug.Log("controller null");
            controller = GetComponent <GameCharController>();
        }
        if (controller.falling == true)
        {
            StopBlock();
        }
        if (isMobile == false)
        {
            if (Input.GetAxis(attackAxis) > 0)
            {
                Attack();
            }
            if (Input.GetAxis(attackSlowAxis) > 0)
            {
                AttackSlow();
            }

            if (Input.GetAxis(blockAxis) > 0)
            {
                Block();
            }
            else
            {
                StopBlock();
            }
            if (Input.GetAxis(rollAxis) > 0)
            {
                Roll();
            }
        }
    }
Esempio n. 3
0
 private void OnEnable()
 {
     GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
     controller = root.GetComponent <GameCharController>();
 }
 // Start is called before the first frame update
 void OnEnable()
 {
     controller     = GetComponent <GameCharController>();
     playerCollider = GetComponent <CapsuleCollider>();
     rb             = GetComponent <Rigidbody>();
 }