Esempio n. 1
0
    private void StartConversation()
    {
        if (lightningUnit == null || earthUnit == null)
        {
            lightningUnit = GameObject.FindGameObjectWithTag("LightningUnit").GetComponent <LightningUnit>();
            earthUnit     = GameObject.FindGameObjectWithTag("EarthUnit").GetComponent <EarthUnit>();
        }

        inCinematic = true;
        conversationPlane.SetActive(true);
        currentSpeachCount = 0;

        if (currentConversation.dialogue[currentSpeachCount].speaker == Speach.Speaker.Clade)
        {
            camController.LookAtPosition(earthUnit.transform.position);
            lightningProfile.SetActive(false);
            earthProfile.SetActive(true);
        }
        else if (currentConversation.dialogue[currentSpeachCount].speaker == Speach.Speaker.Gen)
        {
            camController.LookAtPosition(lightningUnit.transform.position);
            lightningProfile.SetActive(true);
            earthProfile.SetActive(false);
        }

        tmp.text = currentConversation.dialogue[currentSpeachCount].text;
        currentSpeachCount++;
    }
Esempio n. 2
0
 //аналогичный метод создания пути, для юнита игрока
 public void GetUnitWay(EarthUnit human, ref List <Vector3> way, Vector3 point_position)
 {
     if (way.Count == 0)
     {
         NavMeshPath _path = new NavMeshPath();
         NavMesh.CalculatePath(human.transform.localPosition, point_position, NavMesh.AllAreas, _path);
         way.AddRange(_path.corners);
     }
 }
Esempio n. 3
0
    // Spawn's the earth unit and returns a reference to it, takes in an optional spawnHex
    public Unit SpawnEarthUnit(Hex spawnHex = null)
    {
        // use spawn points by default
        if (spawnHex == null)
        {
            GameObject earthGO = GameObject.FindGameObjectWithTag("EarthUnitSpawn");

            if (earthGO)
            {
                Hex spawnHexEarth = earthGO.transform.parent.GetComponent <Hex>();

                Vector3 spawnPosEarth = spawnHexEarth.transform.position;
                spawnPosEarth.y = spawnYLevel;

                earthUnit = Instantiate(Resources.Load <EarthUnit>("PlayerCharacters/EarthUnit"), spawnPosEarth, Quaternion.identity);
                earthUnit.Spawn(spawnHexEarth);

                cameraRig.Init();

                if (lightningUnit)
                {
                    lightningUnit.GetComponent <OverworldFollower>().Init();
                }

                earthUnit.OnDeath += PlayerUnitDied;

                earthDead = false;

                return(earthUnit);
            }
            else
            {
                Debug.LogError("No Earth  spawn point found!");

                return(null);
            }
        }
        else
        {
            // spawn at checkpoint pos

            Vector3 spawnPosEarth = spawnHex.transform.position;
            spawnPosEarth.y = spawnYLevel;

            earthUnit = Instantiate(Resources.Load <EarthUnit>("PlayerCharacters/EarthUnit"), spawnPosEarth, Quaternion.identity);
            earthUnit.Spawn(spawnHex);

            earthUnit.OnDeath += PlayerUnitDied;

            earthDead = false;

            return(earthUnit);
        }
    }
Esempio n. 4
0
    public void Init()
    {
        // set default values for local fields
        canInteract = false;
        myTurn      = false;

        trackingKills           = false;
        encounterKillLimit      = 0;
        encounterHasBoss        = false;
        encounterBossDamage     = 0;
        encounterBossDamageGoal = 0;
        encounterKillCount      = 0;
        lightningDead           = false;
        earthDead     = false;
        AI_controller = GameObject.FindGameObjectWithTag("AI_Controller").GetComponent <AI_Controller>();

        // Subscribe to necessary delegates

        Manager.instance.TurnController.PlayerTurnEvent     += TurnEvent; // only care about our turn, not the AI's
        Manager.instance.StateController.OnGameStateChanged += GameStateChanged;

        GameObject earthGO = GameObject.FindGameObjectWithTag("EarthUnit");

        if (earthGO)
        {
            earthUnit = GameObject.FindGameObjectWithTag("EarthUnit").GetComponent <EarthUnit>();
        }
        else
        {
            Debug.LogError("No Earth unit found!");
        }

        GameObject lightningGO = GameObject.FindGameObjectWithTag("LightningUnit");

        if (lightningGO)
        {
            lightningUnit = GameObject.FindGameObjectWithTag("LightningUnit").GetComponent <LightningUnit>();
        }
        else
        {
            Debug.LogError("No lightning unit found!");
        }



        // Initialise the ToolTip to find the lightning and earth unit
        ToolTip.instance.Init();

        lightningGO.GetComponent <OverworldFollower>().Init();
        earthGO.GetComponent <OverworldFollower>().Init();
    }
Esempio n. 5
0
 //выбор юнита при нажатие на UI элемент - событие PointerDown
 public void PlayerSelectUnit(UnitMechanics unit)//+++
 {
     if (unit.UnitIsMoving())
     {
         return;
     }
     if (selected_unit != null)
     {
         PlayerDeselectUnit();
     }
     selected_unit = unit as EarthUnit;
     selector_ui.transform.position = unit.transform.localPosition + Vector3.up * 1f;
     //selector_ui.transform.localPosition += Vector3.up * 30f;//смещение по оси Y в зависимости от камеры
     selector_ui.SetActive(true);
     ChangeAvatarImage(unit.unit_type);
 }
Esempio n. 6
0
 //событие точки - PointerUp
 public void PlayerPointUp(Image point_image)
 {
     if (current_point == null)
     {
         return;
     }
     point_image.color = new Color(1f, 1f, 1f, 0.4f);//прозрачный тусклый
     //+++
     if (selected_unit == null && !current_point.GetPointStatus())
     {
         player_menu.SetActive(!player_menu.activeSelf);
         if (current_button_index > 0 && CheckPlayerLP(player_unit_cost[current_button_index - 1]))
         {
             selected_unit = game_controller.GetUnitInPool((byte)(current_button_index - 1), true, Vector3.zero) as EarthUnit;//временно - отключаем др. кнопки!
             DeselectButton(player_menu.transform.GetChild(current_button_index - 1).GetComponent <Image>());
             selected_unit.PlayerChosePoint(current_point, point_image.transform);
             player_lp -= player_unit_cost[selected_unit.unit_type - 1]; //+++
             RefreshGameInterface(2, 0);                                 //+++
         }
     }
     selected_unit = null;
     current_point = null;
 }
Esempio n. 7
0
    public void Init()
    {
        GameObject earthGO = GameObject.FindGameObjectWithTag("EarthUnit");

        if (earthGO)
        {
            earthUnit = GameObject.FindGameObjectWithTag("EarthUnit").GetComponent <EarthUnit>();
        }
        else
        {
            Debug.LogError("No Earth unit found!");
        }

        GameObject lightningGO = GameObject.FindGameObjectWithTag("LightningUnit");

        if (lightningGO)
        {
            lightningUnit = GameObject.FindGameObjectWithTag("LightningUnit").GetComponent <LightningUnit>();
        }
        else
        {
            Debug.LogError("No lightning unit found!");
        }
    }
Esempio n. 8
0
 //сброс выбора юнита
 private void PlayerDeselectUnit()//+++
 {
     selected_unit = null;
     selector_ui.SetActive(false);
     ChangeAvatarImage(0);
 }