예제 #1
0
    void LateUpdate()
    {
        float deltaTime = Time.deltaTime;

        if (Mode == CamMode.Free)
        {
            transform.position += transform.forward * Input.GetAxis("Vertical") * deltaTime * FreeMoveSpeed;
            transform.position += transform.right * Input.GetAxis("Horizontal") * deltaTime * FreeMoveSpeed;
            transform.position += transform.up * Input.GetAxis("UpDown") * deltaTime * FreeMoveSpeed;

            if (Input.GetMouseButton(1))
            {
                float newRotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * FreeRotationSpeed;
                float newRotationY = transform.localEulerAngles.x - Input.GetAxis("Mouse Y") * FreeRotationSpeed;
                transform.localEulerAngles = new Vector3(newRotationY, newRotationX, 0f);
            }
        }
        else if (Mode == CamMode.Follow)
        {
            Vector3 rotPoint = FollowInstance.GetInstance().transform.position;
            rotPoint.y += PositionOffset.y;


            //Vector3 viewDir = (FollowInstance.GetTargetPosition() - rotPoint).normalized;
            Vector3    viewDir      = PhxGameRuntime.GetMatch().Player.ViewDirection;
            Vector3    camTargetPos = rotPoint + viewDir * PositionOffset.z;
            Quaternion camTargetRot = Quaternion.LookRotation(viewDir);
            camTargetPos += camTargetRot * new Vector3(PositionOffset.x, 0f, 0f);

            transform.position = camTargetPos; // Vector3.Lerp(transform.position, camTargetPos, deltaTime * FollowSpeed);
            transform.rotation = camTargetRot; // Quaternion.Slerp(transform.rotation, camTargetRot, deltaTime * FollowSpeed);
        }
    }
예제 #2
0
    void OnGUI()
    {
        PhxLuaRuntime rt = PhxGameRuntime.GetLuaRuntime();

        if (!Application.isPlaying || rt == null)
        {
            EditorGUILayout.LabelField("LUA is not running");
            return;
        }

        PhxRuntimeMatch gm = PhxGameRuntime.GetMatch();

        ScrollPos = EditorGUILayout.BeginScrollView(ScrollPos);
        for (int i = 0; i < PhxRuntimeMatch.MAX_TEAMS; ++i)
        {
            PhxRuntimeMatch.PhxTeam t = gm.Teams[i];

            EditorGUILayout.LabelField("Team ID", (i + 1).ToString());
            EditorGUILayout.LabelField("Name", t.Name);
            EditorGUILayout.LabelField("Aggressiveness", t.Aggressiveness.ToString());
            EditorGUILayout.LabelField("Icon", t.Icon?.ToString());
            EditorGUILayout.LabelField("Unit Count", t.UnitCount.ToString());
            EditorGUILayout.LabelField("Reinforcement Count", t.ReinforcementCount.ToString());
            EditorGUILayout.LabelField("Spawn Delay", t.SpawnDelay.ToString());
            EditorGUILayout.LabelField("Hero Class", t.HeroClass?.Name);
            GUILayout.Label("Unit Classes:");
            foreach (PhxRuntimeMatch.PhxUnitClass unitClass in t.UnitClasses)
            {
                EditorGUILayout.LabelField("    " + unitClass.Unit.Name, unitClass.Count.ToString());
            }
            GUILayout.Space(20);
        }
        EditorGUILayout.EndScrollView();
    }
예제 #3
0
 void UpdateColor()
 {
     HoloColor = PhxGameRuntime.GetMatch().GetTeamColor(Team);
     HoloRay?.material.SetColor("_EmissiveColor", HoloColor);
     if (Light != null)
     {
         Light.color = HoloColor;
     }
 }