示例#1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (thi == null)
        {
            thi = this.GetComponent <RotateCollider>();
        }
        if (thi != null && thi.enabled == false)
        {
            return;
        }

        if (collision.transform.name == "CharacterPhysic" && Level_Rotator.RotateTo == Vector3.zero && Level_Rotator.Rotated == false && Level_Rotator.CannotRotateTimer < 0)
        {
            Debug.Log("Dreh dich!");
            Level_Rotator.RotateTo   = RotateTo;
            Level_Rotator.MoveCharTo = MoveCharTo;
            Level_Rotator.MoveCharTo = MoveCharToStart;
            Level_Rotator.Collider   = this.gameObject;

            int x = 0;


            for (x = 0; x < Enable.Length; x++)
            {
                if (Enable[x] != null)
                {
                    Enable[x].enabled = true;
                }
            }

            for (x = 0; x < Disable.Length; x++)
            {
                if (Disable[x] != null)
                {
                    Disable[x].enabled = false;
                }
            }

            if (thi == null)
            {
                thi = this.GetComponent <RotateCollider>();
            }
            if (thi != null)
            {
                thi.enabled = false;
            }
        }
    }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     thi = this.GetComponent <RotateCollider>();
 }