Пример #1
0
    public IEnumerator IStarshipMove(Starship starship)
    {
        Starship_Engine         starship_Engine         = starship.GetComponent <Starship_Engine>();
        Starship_RotationEngine starship_RotationEngine = starship.GetComponent <Starship_RotationEngine>();
        Rigidbody rigidbody = starship.GetComponent <Rigidbody>();

        ToStartPosition(starship);

        OnStartMove?.Invoke();
        starship_Engine.SetLockMove(false);
        while (Vector3.Distance(starship.transform.position, endTr.position) > 1f)
        {
            starship_RotationEngine.RotateToTargetWithPlaneLimiter(endTr.position + endTr.forward);

            starship_Engine.Move(MoveDirectionConsideringAngle(1, Vector3.Angle((endTr.position - rigidbody.velocity - starship.transform.position).normalized, starship.RotationPoint.forward))); // Двигаемся

            yield return(new WaitForFixedUpdate());
        }
        starship_Engine.SetLockMove(true);
        OnEndMove?.Invoke();
    }
Пример #2
0
    private void Awake()
    {
        GameManager.Initialize();

        SceneController.LoadAdditiveScene(sceneLocation);
        GameText.DeactivateEvent();
        GameText.SetInGameTextNowEvent(textAsset);

        systemStarships = GetComponent <System_Starships>();

        playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Starship_Controller>();
        playerCamera     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Player_Camera_Controller>();
        playerStarship   = playerController.GetComponent <Starship>();
        playerController.GetComponent <Health>().OnDeath += OnPlayerDeath;

        systemStarships.StarshipsTeams.Add(new System_Starships.StarshipsTeam(playerStarship.GetComponent <Starship>()));
        systemStarships.StarshipsTeams.Add(new System_Starships.StarshipsTeam());

        playerCamera.SetPositionWithOffset(playerController.transform.position);
        screenDark.SetDark(false);
        playerController.SetLockControl(true);
    }