コード例 #1
0
 public GalaxyPlanetInfoViewModel(EnemyPlanet planet)
 {
     BaseInfoViewModel      = new GalaxyPlanetBaseInfoViewModel(planet);
     BuildingsInfoViewModel = new GalaxyPlanetBuildingsInfoViewModel(planet);
     DefenseInfoViewModel   = new GalaxyPlanetDefenseInfoViewModel(planet);
     FleetInfoViewModel     = new GalaxyPlanetFleetInfoViewModel(planet);
 }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Started CommunicatesManager");
        enemyPlanet = FindObjectOfType <EnemyPlanet>();
        asteroid    = FindObjectOfType <AsteroidMovement>();
        diff        = enemyPlanet.enemyPosition - asteroid.transform.position;
        Debug.Log(diff);

        // 23 and 29 are primes, which means that they will cross on 23*29 time, it's longer than desired game
        // lenght (600 seconds) which means that philosophical communicates won't update at the same time as the other ones.
        InvokeRepeating("UpdateCommunicates", 20f, 11f);
    }
コード例 #3
0
    //function give damage if the particule and planet different type or give energy if the same type
    public void GetDamageOrEnergy(GameObject objectInCollision)
    {
        if (objectInCollision.CompareTag(GV.PLAYER_PLANET_TAG))
        {
            PlayerPlanet playerPlanet = objectInCollision.GetComponent <PlayerPlanet>();
            if (particuleType == playerPlanet.type)
            {
                if (playerPlanet.currentHealth < playerPlanet.capacity)
                {
                    playerPlanet.currentHealth += value;
                    GameObject.Destroy(this.gameObject);
                }
            }
            else
            {
                if (playerPlanet.currentHealth > 0)
                {
                    playerPlanet.currentHealth -= value;
                }
                GameObject.Destroy(this.gameObject);
            }
            //Debug.Log("player planet heath" + playerPlanet.currentHealth);
        }
        else if (objectInCollision.CompareTag(GV.ENEMY_PLANET_TAG))
        {
            EnemyPlanet enemyPlanet = objectInCollision.GetComponent <EnemyPlanet>();
            if (particuleType == enemyPlanet.type)
            {
                if (enemyPlanet.currentHealth < enemyPlanet.capacity)
                {
                    enemyPlanet.currentHealth += value;
                    GameObject.Destroy(this.gameObject);
                }
            }
            else
            {
                if (enemyPlanet.currentHealth > 0)
                {
                    enemyPlanet.currentHealth -= value;
                }
                GameObject.Destroy(this.gameObject);
            }

            //Debug.Log("enemy planet heath" + enemyPlanet.currentHealth);
        }
    }
コード例 #4
0
    public override void InitPlanet(Transform _enemyPlanets)
    {
        EnemyPlanets = _enemyPlanets;

        //listeEnemyPlanets = new Dictionary<Transform, EnemyPlanet>();
        listPlanetForEveryManager = new Dictionary <Transform, Planet>();
        foreach (Transform enemyPlanet in EnemyPlanets)
        {
            if (enemyPlanet != null)
            {
                EnemyPlanet enemyPlanetComponemt = enemyPlanet.GetComponent <EnemyPlanet>();
                enemyPlanetComponemt.InitPlanet();
                //listeEnemyPlanets.Add(enemyPlanet, enemyPlanetComponemt);
                listPlanetForEveryManager.Add(enemyPlanet, enemyPlanetComponemt);
            }
        }
    }
コード例 #5
0
    //add new enemy planet to the list
    public override void AddPlanet(Transform positioToAddThePlanet, float maxLevel)
    {
        GameObject enemyPlanet = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs\\Entities\\EnemyPlanet"));

        enemyPlanet.name  = "EnemyPlanet";
        enemyPlanet.tag   = GV.ENEMY_PLANET_TAG;
        enemyPlanet.layer = LayerMask.NameToLayer(GV.ENEMY_PLANET_TAG);
        enemyPlanet.transform.position = positioToAddThePlanet.position;
        enemyPlanet.transform.SetParent(GameObject.FindGameObjectWithTag(GV.PARENT_ENEMY_PLANET).transform);
        EnemyPlanet enemyPlanetComponent = enemyPlanet.GetComponent <EnemyPlanet>();

        if (enemyPlanetComponent == null)
        {
            Debug.LogError("Enemy planet component not attached to the new planet " + enemyPlanet.name);
        }
        else
        {
            enemyPlanetComponent.InitPlanet();
            enemyPlanetComponent.maxLevel = maxLevel;
            listPlanetForEveryManager.Add(enemyPlanet.transform, enemyPlanetComponent);
        }
    }
コード例 #6
0
 public GalaxyPlanetDefenseInfoViewModel(EnemyPlanet planet)
 {
     _planet = planet;
 }
コード例 #7
0
 public GalaxyPlanetInfo(EnemyPlanet planet)
 {
     ViewModel = new GalaxyPlanetInfoViewModel(planet);
     InitializeComponent();
     DataContext = ViewModel;
 }
コード例 #8
0
 public GalaxyPlanetBuildingsInfoViewModel(EnemyPlanet planet)
 {
     _planet = planet;
 }
コード例 #9
0
 public GalaxyPlanetFleetInfoViewModel(EnemyPlanet planet)
 {
     _planet = planet;
 }
コード例 #10
0
 public EspionageReport(int messageId, DateTime messageDate, EnemyPlanet target) : base(messageId, messageDate, MessageType.Espionage, MessageStatus.New)
 {
     Target = target;
 }