Ejemplo n.º 1
0
    private new void Awake()
    {
        RegisterListeners();
        base.Awake();

        navigation = (PlayerNavigation)navigationController;
    }
Ejemplo n.º 2
0
        public static bool DetermineHighOperation(ref PlayerNavigation __instance, ref float ___arriveFactor,
                                                  float speedWanted, ref bool lift, ref bool drop)
        {
            var getPlayer = Traverse.Create(__instance).Method("get_player").GetValue <Player>();

            var num1 = PlayerNavigation.SphericalDistance(getPlayer.position, __instance.naviTarget,
                                                          (double)getPlayer.planetData.realRadius * getPlayer.planetData.GetScaleFactored(), false);

            Debug.Log("num1" + num1);

            var num2 = ___arriveFactor / speedWanted;

            if (__instance.useSailFinally && num1 > 80.0)
            {
                lift = true;
            }

            if (num2 >= 2.0)
            {
                return(false);
            }

            drop = true;
            return(false);
        }
Ejemplo n.º 3
0
    void Start()
    {
        navAgent = GetComponent <NavMeshAgent>();

        playerNav = GetComponent <PlayerNavigation>();

        UI = GameObject.FindGameObjectWithTag("UI").GetComponent <PlayerUI> ();

        navMeshPath = new NavMeshPath();

        navAgent.stoppingDistance = proximityThreshold;
    }
Ejemplo n.º 4
0
            private static void Prefix(UIStarmap __instance)
            {
                PlayerNavigation navigation = GameMain.mainPlayer.navigation;

                if (__instance.focusPlanet != null &&
                    navigation.indicatorAstroId != __instance.focusPlanet.planet.id)
                {
                    autoNav.target.SetTarget(__instance.focusPlanet.planet);
                }
                else if (__instance.focusStar != null &&
                         navigation.indicatorAstroId != __instance.focusStar.star.id * 100)
                {
                    autoNav.target.SetTarget(__instance.focusStar.star);
                }
            }
Ejemplo n.º 5
0
    public override void OnInspectorGUI()
    {
        PlayerNavigation script = (PlayerNavigation)target;

        GUIContent arrayLabel = new GUIContent("CollectibleType");

        script.CollectibleType_Index = EditorGUILayout.Popup(arrayLabel, script.CollectibleType_Index, script.CollectibleType);

        GUIContent arrayLabel1 = new GUIContent("CollectibleColor");

        script.CollectibleColor_Index = EditorGUILayout.Popup(arrayLabel1, script.CollectibleColor_Index, script.CollectibleColor);

        EditorGUILayout.Space();
        EditorGUILayout.Space();

        base.OnInspectorGUI();
    }
Ejemplo n.º 6
0
        public static bool DetermineLowVelocity(
            float speedWanted,
            float turningRatio,
            ref Vector3 vel,
            ref bool fly,
            ref PlayerNavigation __instance
            )
        {
            var getPlayer  = Traverse.Create(__instance).Method("get_player").GetValue <Player>();
            var realRadius = getPlayer.planetData.realRadius;

            Debug.Log("realRadius" + realRadius);
            var vector3_1 = getPlayer.position.normalized * realRadius;

            Debug.Log("vector3_1" + vector3_1);
            Vector3 vector3_2 = __instance.naviTarget.normalized * realRadius;

            Debug.Log("vector3_2" + vector3_2);
            var normalized1 = vector3_1.normalized;

            Debug.Log("normalized1" + normalized1);
            var rhs = vector3_2 - vector3_1;

            Debug.Log("rhs" + rhs);
            var magnitude = rhs.magnitude;

            Debug.Log("magnitude" + magnitude);
            var normalized2 = Vector3.Cross(Vector3.Cross(normalized1, rhs).normalized, normalized1).normalized;

            Debug.Log("normalized2" + normalized2);
            vel = Vector3.Slerp(vel, normalized2 * speedWanted, turningRatio);
            if (!__instance.useFlyFinally || magnitude <= 20.0)
            {
                return(false);
            }
            fly = true;
            return(false);
        }
 private void FollowPlayerIfReachable()
 {
     if (player != null)
     {
         if (Vector3.Distance(transform.position, player.position) <= TriggerDist)
         {
             agent.destination = player.position;
             transform.LookAt(player.transform);
         }
         if (Vector3.Distance(transform.position, player.position) <= MinDist)
         {
             agent.destination = transform.localPosition;
             PlayerNavigation nav = player.GetComponent <PlayerNavigation>();
             deltaTime += Time.deltaTime;
             if (deltaTime >= 1)
             {
                 nav.Damage(damage);
                 animator.SetTrigger("Attack");
                 deltaTime = 0;
             }
         }
     }
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Awake()
 {
     playerNavigation = GetComponent <PlayerNavigation>();
     inputField.onEndEdit.AddListener(AcceptStringInput);
     inputField.ActivateInputField();
 }
Ejemplo n.º 9
0
 void Start()
 {
     cam = Camera.main;
     nav = GetComponent <PlayerNavigation>();
 }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     playerNavigation = GetComponent <PlayerNavigation>();
     playerNavigation.changeObject(startObject);
 }