Beispiel #1
0
    public void ExecuteNode(ref BattleManagerScript _battleScript, ref GameObject _battlePanel, ref GameObject _battleManager, ref GameObject _eventPanel, ref GameObject PanelDesc, ref GameObject PanelOption1, ref GameObject PanelOption2)
    {
        _visited = true;
        if (_nodeType == NODE_TYPES.BATTLE)
        {
            _battleManager.SetActive(true);
            _battlePanel.SetActive(true);

            _battleScript.StartBattle();
            //freezeplanet movement;
            _gameObject.GetComponent <MeshRenderer>().material.color = Color.magenta;
        }
        else if (_nodeType == NODE_TYPES.EVENT)
        {
            _gameObject.GetComponent <MeshRenderer>().material.color = Color.magenta;


            //  transform.Find("waterStock").GetComponent<Text>().text = player.GetComponent<PlayerScript>().water.ToString();
            _eventPanel.SetActive(true);
            PanelDesc.transform.GetComponent <Text>().text    = _tree._eventDesciption;
            PanelOption1.transform.GetComponent <Text>().text = _tree._option1._optionText;
            PanelOption2.transform.GetComponent <Text>().text = _tree._option2._optionText;
            // _eventPanel.transform.GetComponent<Description>().GetComponent<Text>().text = _tree._eventDesciption;
            // _eventPanel.GetComponent<Option1>().text = _tree._option1._optionText;
            // _eventPanel.GetComponent<Option2>().text = _tree._option2._optionText;

            ;
        }
    }
Beispiel #2
0
    public void Attacked(float Attacked)
    {
        //float damage = Mathf.Max(Attacked - defense);
        BattleManagerScript battle_manager_script = GameObject.FindGameObjectWithTag("BattleManager").GetComponent <BattleManagerScript>();

        if (HP > 0)
        {
            Damage = Defense - Attacked;
            if (Damage < 0)
            {
                HP = HP + Damage;
            }
            if (HP < 0)
            {
                sliderHP.value = 0;
                battle_manager_script.Finish(player_die: true);
            }
        }
        else
        {
            sliderHP.value = 0;
            battle_manager_script.Finish(player_die: true);
        }
        sliderHP.value = HP / 100.0f;
    }
Beispiel #3
0
 void Awake()
 {
     if (BattleManagerScript.CheckInstanceExit())
     {
         Destroy(this.gameObject);
     }
 }
Beispiel #4
0
    void Respawn()
    {
        BattleManagerScript battleScript = battleManager.GetComponent <BattleManagerScript>();

        lives -= 1;
        thisRigid.velocity = new Vector3(0, 0, 0);
        transform.position = battleScript.bestSpawn;
    }
Beispiel #5
0
 private void InitializeBattleManager(Scene scene, LoadSceneMode mode)
 {
     if (scene.name == BATTLE_SCENE_NAME)
     {
         battleManagerInstance = ((GameObject)Instantiate(battleManager, transform.position, transform.rotation)).GetComponent <BattleManagerScript>();
         battleManagerInstance.inputReciever = inputReciever;
         battleManagerInstance.prefabInst    = prefabPuller;
         battleManagerInstance.SetUpParties(party, encounter, mapInfo);
         inputReciever.GetComponent <InputReciever>().SetControlState(InputReciever.BATTLE_STATE);
     }
 }
Beispiel #6
0
 // Start is called before the first frame update
 void Start()
 {
     MyTurn = InitTurn;
     battle_manager_script = GameObject.FindGameObjectWithTag("BattleManager").GetComponent <BattleManagerScript>();
     name          = enemyName;
     Player        = GameObject.FindGameObjectWithTag("Player");
     player_status = Player.GetComponent <PlayerStatus>();
     GameManager   = GameObject.FindWithTag("GameController");
     EnemyTurnText.GetComponent <Text>().text = "残りのターン: " + MyTurn.ToString();
     //先手攻撃
     battle_manager_script.EnemySpeedAttackCheck(this);
 }
Beispiel #7
0
    // Setup function
    private void Awake()
    {
        instance        = this;
        instructionText = GameObject.Find("InstructionText").GetComponent <Text>();

        timer          = GameObject.Find("Timer").GetComponent <TimerScript>(); // or could create one here; timer is unnecessary is a single-player game
        resolvingTurn += timer.stopTimer;
        newTurn       += timer.restartTimer;

        players = new List <GameObject>();

        spawnPlayer(0, true);

        // This could loop through a list of connected devices/sockets to add multiplayer capabilities
        for (int i = 1; i < PLAYER_COUNT; i++)
        {
            spawnPlayer(i, false);
        }

        submittedActions = new List <IActionCommand>();
    }
Beispiel #8
0
    GameObject findNearestPlayerPosition()
    {
        GameObject          currentNearest;
        float               currentNearestDistance;
        BattleManagerScript battleScript = battleManager.GetComponent <BattleManagerScript>();

        currentNearest         = battleScript.players[0];
        currentNearestDistance = 100000f;

        for (int i = 0; i < battleScript.playersNumber; i++)
        {
            if (battleScript.players[i] != null)
            {
                if (FindDistance(transform, battleScript.players[i].transform) < currentNearestDistance && battleScript.players[i].transform != transform)
                {
                    currentNearest         = battleScript.players[i];
                    currentNearestDistance = FindDistance(transform, battleScript.players[i].transform);
                }
            }
        }

        return(currentNearest);
    }
Beispiel #9
0
    private void OnEnable()
    {
        battleManager = GameObject.FindGameObjectWithTag("Battle Manager").GetComponent <BattleManagerScript>();

        rewards = battleManager.enemy.currentDeck.GetRewardCards();


        //Spawn in each reward card
        for (int i = 0; i < rewards.Count; i++)
        {
            GameObject rewardCard = Instantiate(rewardCardPrefab, rewardCardPanel.transform);

            UiCardScript UICard = rewardCard.GetComponent <UiCardScript>();
            UICard.info = rewards[i];


            Button cardButton = rewardCard.GetComponent <Button>();

            cardButton.onClick.RemoveAllListeners();
            cardButton.onClick.AddListener(delegate { AddCard(UICard.info); });

            cardButton.Select();
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     battle_manager_script = GameObject.FindWithTag("BattleManager").GetComponent <BattleManagerScript>();
     player_status         = GameObject.FindWithTag("Player").GetComponent <PlayerStatus>();
 }
 // Start is called before the first frame update
 void Start()
 {
     this.gameObject.GetComponent <Button>().Select();
     fight_enemy_create    = FightEnemyCreate.fight_enemy_create;
     battle_manager_script = GameObject.FindWithTag("BattleManager").GetComponent <BattleManagerScript>();
 }
 // Start is called before the first frame update
 void Start()
 {
     battleManagerScript = BattleManagerScript.battle_manager_script;
 }
Beispiel #13
0
 // Use this for initialization
 void Start()
 {
     battleManager = BattleManagerScript.Instance;
     GetComponent <Image>().sprite = defaultEye;
 }
Beispiel #14
0
 void Awake()
 {
     Instance = this;
 }
 private void Awake()
 {
     battle_manager_script = this;
 }
Beispiel #16
0
    public void Start()
    {
        m_nodeController = ScriptableObject.CreateInstance <NodeController>();
        // Create an icosahedron, subdivide it three times so that we have plenty of polys
        // to work with.
        CreateIcoSphere();
        Subdivide(4);
        // When we begin extruding polygons, we'll need each one to know who its immediate
        //neighbors are.
        CalculateNeighbors();
        // By default, everything is colored blue.

        foreach (Polygon p in m_Polygons)
        {
            p.m_Color = colorOcean;
        }

        // randomly sized spheres on the surface of the planet, and adding any Polygon that falls
        // inside that sphere.
        for (int i = 0; i < m_NumberOfContinents; i++)
        {
            float continentSize = Random.Range(m_ContinentSizeMin, m_ContinentSizeMax);

            PolySet newLand = GetPolysInSphere(Random.onUnitSphere, continentSize, m_Polygons);

            landPolys.UnionWith(newLand);
        }

        // This is our land now, so color it green. =)

        foreach (Polygon landPoly in landPolys)
        {
            landPoly.m_Color = colorGrass;
        }

        // The Extrude function will raise the land Polygons up out of the water.
        // It also generates a strip of new Polygons to connect the newly raised land
        // back down to the water level. We can color this vertical strip of land brown like dirt.

        PolySet sides = Extrude(landPolys, 0.05f);

        foreach (Polygon side in sides)
        {
            side.m_Color = colorDirt;
        }

        // Grab additional polygons to generate hills, but only from the set of polygons that are land.



        for (int i = 0; i < m_NumberOfHills; i++)
        {
            float hillSize = Random.Range(m_HillSizeMin, m_HillSizeMax);

            PolySet newHill = GetPolysInSphere(Random.onUnitSphere, hillSize, landPolys);

            hillPolys.UnionWith(newHill);
        }

        sides = Extrude(hillPolys, 0.05f);

        foreach (Polygon side in sides)
        {
            side.m_Color = colorDirt;
        }

        _battleManager = Object.Instantiate(_battleManager, Vector3.zero, Quaternion.identity);
        _battleScript  = _battleManager.GetComponent <BattleManagerScript>();
        GenerateMesh();
        GetWaterPolygons();
        SpawnNodes(water);
    }