Example #1
0
 public override void Enemy_Init(EnemySettings settings, int laneId)
 {
     anim.Play("copShieldIdle");
     state = states.IDLE;
     GetComponent<BoxCollider2D>().enabled = true;
     heads.sprite = Data.Instance.enemiesManager.GetRandomHead();
 }
 void OnAddCoins(int laneID, float distance, int mnultiplayerStolen)
 {
     //  print("OnAddCoins  lane: " + laneID + " distance: " + distance);
     EnemySettings settings = new EnemySettings();
     settings.qty = mnultiplayerStolen;
     levelsManager.lanes.AddObjectToLane("CoinParticles", laneID, (int)distance, settings);
 }
Example #3
0
 void AddEnemy(string objectName, int lane, int distance)
 {
     Lanes lanes = Game.Instance.GetComponent<LevelsManager>().lanes;
     EnemySettings settings = new EnemySettings();
     settings.speed = 0.03f;
     lanes.AddObjectToLane(objectName, lane, distance, settings);
 }
Example #4
0
 public void Init(EnemySettings settings, int laneId)
 {
     if (shadow != null) shadow.SetActive(true);
     isPooled = false;
     isActivated = false;
     this.laneId = laneId;
     Enemy_Init(settings, laneId);
 }
Example #5
0
 public override void Enemy_Init(EnemySettings settings, int laneId)
 {
     SpriteRenderer[] sps = GetComponentsInChildren<SpriteRenderer>();
        foreach (SpriteRenderer sp in sps)
        {
       // sp.sortingOrder = -1;
       // sp.sortingLayerName = "Default";
        }
 }
Example #6
0
    public void AddObjectToLane(string name, int laneId, int _x, EnemySettings settings )
    {
        //  print("new : " + name);
        Enemy enemy = null;

        switch (name)
        {
            case "CoinParticles":
                enemy = Data.Instance.enemiesManager.GetEnemy("CoinParticles");
                enemy.GetComponent<CoinsParticles>().particles.Emit(settings.qty);
                enemy.GetComponent<CoinsParticles>().InitParticles();
                break;
            case "Skate":
                enemy = Data.Instance.enemiesManager.GetEnemy("Skate");
                break;
            case "ObstacleGeneric":
                enemy = Data.Instance.enemiesManager.GetEnemy("ObstacleGeneric");
                break;
            case "Victim":
                enemy = Data.Instance.enemiesManager.GetEnemy("Victim");
                break;
            case "RatiJump":
                enemy = Data.Instance.enemiesManager.GetEnemy("RatiJump");
                break;
            case "RatiEscudo":
                enemy = Data.Instance.enemiesManager.GetEnemy("RatiEscudo");
                break;
            case "PowerUp":
                if(Game.Instance.gameManager.characterManager.character.powerupManager.type == PowerupManager.types.NONE)
                    enemy = Data.Instance.enemiesManager.GetEnemy("PowerUp");
                break;
            case "Coin":
                enemy = Data.Instance.enemiesManager.GetEnemy("Coins");
                break;
            case "ExplosionRatis":
                enemy = Data.Instance.enemiesManager.GetEnemy("ExplosionRatis");
                break;
            case "Resorte":
                enemy = Data.Instance.enemiesManager.GetEnemy("Resorte");
                break;
            case "PowerDown":
              //  if (Game.Instance.gameManager.characterManager.character.powerupManager.type == PowerupManager.types.NONE)
                    enemy = Data.Instance.enemiesManager.GetEnemy("PowerDown");
                break;
        }
        if (enemy == null)
            return;

        GameObject go = enemy.gameObject;
        sortInLayersByLane(go, laneId);

        go.transform.SetParent(all[laneId].transform);
        go.transform.localPosition = new Vector3(_x, 0, 0);
        enemy.Init(settings, laneId);
    }
Example #7
0
    public override void Enemy_Init(EnemySettings settings, int laneId)
    {
        collider = GetComponent<BoxCollider2D>();
        clothes = GetComponent<Clothes>();
        clothes.Restart();

        distance = Game.Instance.gameManager.distance;
        speed = settings.speed;
        Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);

        if (speed < 0)
            scale.x *= -1;

        transform.localScale = scale;

        Walk();
    }
Example #8
0
 public void GetStatusValue()
 {
     XmlDocument xmlDoc = new XmlDocument();
     xmlDoc.LoadXml(GameAsset.text);
     XmlNodeList setting_values = xmlDoc.GetElementsByTagName(enemiesSettingsTag);
     enemiesSettings = new List<EnemySettings>();
     foreach (XmlNode setting_value in setting_values) {
         XmlNodeList status_contents = setting_value.ChildNodes;
         EnemySettings enemySettings = new EnemySettings();
         enemySettings.statusValues = new Dictionary<string, string>();
         foreach (XmlNode status_content in status_contents) {
             foreach (string tag_name in Enum.GetNames(typeof(TagNames))) {
                 if (status_content.Name == tag_name) {
                     enemySettings.statusValues.Add(tag_name, status_content.InnerText);
                 }
             }
         }
         enemiesSettings.Add(enemySettings);
     }
 }
Example #9
0
 public HealthListener(EnemySettings _enemySettings, EnemyBase _enemy)
 {
     enemySettings = _enemySettings;
     enemy         = _enemy;
 }
Example #10
0
 public override void Enemy_Init(EnemySettings settings, int laneId)
 {
     anim = GetComponentInChildren<Animator>();
     anim.Play("idle", 0, 0);
 }
Example #11
0
 public override void Enemy_Init(EnemySettings settings, int laneId)
 {
     collider = GetComponent<BoxCollider2D>();
 }
Example #12
0
 override public void Enemy_Init(EnemySettings settings, int laneId)
 {
 }
Example #13
0
 public override void Enemy_Init(EnemySettings settings, int laneId)
 {
     moved = false;
     anim.Play("idle");
     heads.sprite = Data.Instance.enemiesManager.GetRandomHead();
 }
Example #14
0
    public static void Save(int level, int ammo, List <EnemigoManager> enemies, Vector3 playerPos, List <Puerta> puertas, List <Boton> botones)
    {
        List <EnemySettings> enemiesOut = new List <EnemySettings>();

        foreach (EnemigoManager e in enemies)
        {
            EnemySettings eSettings = new EnemySettings();
            eSettings.tr_          = e.transform.position;
            eSettings.state        = e.getEnemy().GetState();
            eSettings.prevstate    = e.getEnemy().GetPrevState();
            eSettings.nodes_.nodes = e.GetNodes();
            eSettings.nodes_.count = eSettings.nodes_.nodes.Count;
            enemiesOut.Add(eSettings);
        }
        List <PuertasStates> puertasOut = new List <PuertasStates>();

        foreach (Puerta p in puertas)
        {
            PuertasStates pOut = new PuertasStates();
            pOut.position_ = p.transform.position;
            if (p.GetOpen())
            {
                pOut.rotation_ = p.GetEndRot();
            }
            else
            {
                pOut.rotation_ = p.transform.localEulerAngles;
            }
            pOut.open_ = p.GetOpen();
            puertasOut.Add(pOut);
        }

        List <BotonStates> botonOut = new List <BotonStates>();

        foreach (Boton b in botones)
        {
            BotonStates bOut = new BotonStates();
            bOut.position_ = b.transform.position;
            if (b.IsActive())
            {
                bOut.active = true;
                List <LaserTr> laserListOut = new List <LaserTr>();
                foreach (GameObject l in b.GetLaser())
                {
                    LaserTr laserOut = new LaserTr();
                    laserOut.positon_       = l.transform.position;
                    laserOut.rotation_      = l.transform.localEulerAngles;
                    laserOut.intermitencia_ = l.GetComponent <Laser>().GetIntermitencia();
                    laserListOut.Add(laserOut);
                }
                bOut.laser = laserListOut;
            }
            else
            {
                bOut.active = false;
                bOut.laser  = null;
            }
            botonOut.Add(bOut);
        }

        GameSave save = new GameSave
        {
            level_     = level,
            ammo_      = ammo,
            playerPos_ = playerPos,
            enemies_   = enemiesOut,
            puertas_   = puertasOut,
            botones_   = botonOut
        };

        string jsonOut = JsonUtility.ToJson(save);

        File.WriteAllText(SaveDirectory + "/saveGame.txt", jsonOut);

        Debug.Log("GameFile saved in " + SaveDirectory);
    }
Example #15
0
 public override void Enemy_Init(EnemySettings settings, int laneId)
 {
 }
Example #16
0
 public override void Enemy_Init(EnemySettings settings, int laneId)
 {
     collider = GetComponent<BoxCollider2D>();
     anim.Play("alcantaIdle", 0, 0);
 }
Example #17
0
 override public void Enemy_Init(EnemySettings settings, int laneId)
 {
     anim = GetComponentInChildren <Animator>();
     anim.Play("idle", 0, 0);
 }
Example #18
0
 public virtual void Enemy_Init(EnemySettings settings, int laneId)
 {
 }
Example #19
0
 public override int getScore()
 {
     return(EnemySettings.getScore(1));
 }
Example #20
0
    private void LoadLevelAssets(int nextLevelDistance)
    {
        //print("nextLevelDistance" + nextLevelDistance);
        //print("activeLevel" + activeLevel);
        Lanes laneData = activeLevel.GetComponent<Lanes>();
        lanes.AddBackground(laneData.vereda, nextLevelDistance, activeLevel.length);

        foreach (Lane lane in laneData.all)
        {
            Transform[] allObjectsInLane = lane.transform.GetComponentsInChildren<Transform>(true);
            foreach (Transform t in allObjectsInLane)
            {
                 EnemySettings settings = new EnemySettings();

                settings.speed = 0.05f;
                if(t.transform.localScale.x < 0)
                    settings.speed = -0.05f;

                lanes.AddObjectToLane(t.gameObject.name, lane.id, (int)(nextLevelDistance + t.transform.localPosition.x), settings);
            }
        }
    }
Example #21
0
 public virtual int getScore()
 {
     return(EnemySettings.getScore(0));
 }
Example #22
0
 public void UpdateEnemySettings(EnemySettings enemySettings)
 {
     activeEnemySettings = enemySettings;
     UpdateInternalSettings();
 }