Ejemplo n.º 1
0
 void OnTriggerStay(Collider col)
 {
     if (col.gameObject.tag == "EnergyBlade")
     {
         EnergyBlade otherBlade = col.gameObject.GetComponent <EnergyBlade>();
         if (!otherBlade.Equals(pc.GetLeftBlade()) && otherBlade.IsOffensive() && !damaged)
         {
             StartCoroutine(pc.HitByBlade());
         }
     }
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        SyncVarsWithActorScript();



        if (isBuildPlayer)
        {
            gameObject.transform.position    = VRHead.transform.position;
            gameObject.transform.eulerAngles = new Vector3(0, VRHead.transform.eulerAngles.y, 0);

            if (VRLeft != null)
            {
                if (VRLeft.activeSelf)
                {
                    playerLeftHand.transform.parent   = this.transform.parent;
                    playerLeftHand.transform.position = VRLeft.transform.position;
                    playerLeftHand.transform.rotation = VRLeft.transform.rotation;
                }
                else
                {
                    //playerLeftHand.transform.position = new Vector3(transform.position.x - .35f, transform.position.y - .6f, transform.position.z + .35f);
                    playerLeftHand.transform.parent        = this.transform;
                    playerLeftHand.transform.localPosition = new Vector3(-1.75f, -1.5f, 1.75f);
                }
            }
            if (VRRight != null)
            {
                if (VRRight.activeSelf)
                {
                    playerRightHand.transform.parent   = this.transform.parent;
                    playerRightHand.transform.position = VRRight.transform.position;
                    playerRightHand.transform.rotation = VRRight.transform.rotation;
                }
                else
                {
                    //playerRightHand.transform.position = new Vector3(transform.position.x + .35f, transform.position.y - .6f, transform.position.z + .35f);
                    playerRightHand.transform.parent        = this.transform;
                    playerRightHand.transform.localPosition = new Vector3(1.75f, -1.5f, 1.75f);
                }
            }
        }
        else
        {
            gameObject.transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0);
        }

        UpdateDamageIndication();

        if (isBuildPlayer)
        {
            if (leftBlade != null)
            {
                bladeOffensive = leftBlade.IsOffensive();
            }
        }
        else
        {
            if (leftBlade != null)
            {
                leftBlade.SetOffenseMode(bladeOffensive);
            }
        }


        if (isBuildPlayer)
        {
            if (Input.GetKeyDown("k"))
            {
                damaged = true;
            }
            if (Input.GetKeyUp("k"))
            {
                damaged = false;
            }
        }
    }
Ejemplo n.º 3
0
 void OnTriggerStay(Collider col)
 {
     if (isBuildPlayer && col.gameObject.tag == "EnergyBlade")
     {
         EnergyBlade otherBlade = col.gameObject.GetComponent <EnergyBlade>();
         if (otherBlade != null && !otherBlade.Equals(leftBlade) && !otherBlade.Equals(rightBlade) && otherBlade.IsOffensive() && !damaged)
         {
             StartCoroutine(HitByBlade());
         }
     }
 }