Esempio n. 1
0
    /// <summary>
    /// OnTriggerEnter is called when the Collider other enters the trigger.
    /// </summary>
    /// <param name="other">The other Collider involved in this collision.</param>
    void OnTriggerEnter(Collider other)
    {
        BaseNode node  = other.transform.GetComponentInParent <BaseNode>();
        Enemy    enemy = other.GetComponent <Enemy>();

        if (node != null)
        {
            List <BaseNode> nodes = WorldController.Instance.GetNodesNearPlayer(this.transform, node);
            if (OnInfoUpdatedEvent != null)
            {
                OnNewTileEnteredEvent(nodes);
            }
        }

        if (enemy != null && !enemy.dead)
        {
            BattleData battleData = Resources.Load <BattleData>("Data/BattleData");
            LocalData  localData  = Resources.Load <LocalData>("Data/LocalData");

            battleData.ResetData();
            battleData.Friendlies.Add(this.entityData);
            battleData.Enemies.Add(enemy.entityData);
            //battleData.enemyObject = enemy.gameObject;
            //TODO: this is probably temp so remove it
            enemy.dead = true;
            localData.playerShipPos = transform.position;

            EnemyManager.PopulateLocalDataEnemyInfo(localData, enemy.gameObject);

            MainUIController.Instance.fadingInPanel = true;
            MainUIController.Instance.scene         = "Battle";
        }
    }
    private void Start()
    {
        battleData = Resources.Load <BattleData>("Data/BattleData");
        World.Instance.gameObject.SetActive(true);
        player = GameObject.FindObjectOfType <Player>();
        player.transform.position = localData.playerShipPos;

        //TODO: Create a function which updates all of the player's stuff after a battle

        if (battleData.Friendlies.Count > 0)
        {
            player.entityData = battleData.Friendlies[0];
        }

        player.SetInfamy(battleData.InfamyReward);

        battleData.InfamyReward = 0;
        battleData.ResetData();
        localData.ResetData();
        //MainUIController.Instance.UpdateInfamy();
    }
    // Use this for initialization
    void Start()
    {
        BattleData data = Resources.Load <BattleData>("Data/BattleData");

        data.ResetData();
    }