コード例 #1
0
    public void Init(Boss _boss, BossSettings settings)
    {
        isOn           = true;
        this.totalLife = lifes;

        initialScale = transform.localScale;
        this.boss    = _boss;
        Utils.RemoveAllChildsIn(transform);

        if (asset == null && settings.asset != null)
        {
            if (settings.bundle)
            {
                asset = Instantiate(ObjectPool.instance.bossesPool.GetBossAsset(settings.asset).gameObject);
            }
            else
            {
                asset = Instantiate(Resources.Load("bosses/assets/" + settings.asset, typeof(GameObject))) as GameObject;
            }
            asset.transform.SetParent(transform);
            asset.transform.localScale       = Vector3.one;
            asset.transform.localEulerAngles = Vector3.zero;
            asset.transform.localPosition    = Vector3.zero;
            anim = asset.GetComponentInChildren <Animation>();
        }
        //if (progressBar == null)
        //{
        //    progressBar = (Instantiate(Resources.Load("ProgressBar", typeof(GameObject))) as GameObject).GetComponent<ProgressBar>();
        //    progressBar.SetProgression(1);
        //    progressBar.transform.SetParent(transform);
        //    progressBar.transform.localScale = Vector3.one;
        //    progressBar.transform.localEulerAngles = Vector3.zero;
        //    progressBar.transform.localPosition = progressBarPosition;
        //}
    }
コード例 #2
0
 public void OnHit(BallBehaviour _ball, Vector3 _impactVector, PawnController _thrower, float _damages, DamageSource _source, Vector3 _bumpModificators = default)
 {
     if (_source == DamageSource.Ball)
     {
         EnergyManager.IncreaseEnergy(BossSettings.GetDatas().staggerSettings.energyGainedOnHit);
     }
 }
コード例 #3
0
ファイル: BossBullet.cs プロジェクト: ButterKane/Robot-emUp
 public void Init(BossSettings _bossSettings)
 {
     bossDatas = _bossSettings;
     model     = transform.Find("Model");
     Destroy(this.gameObject, bossDatas.bulletStormSettings.bulletLifetime);
     lockable = bossDatas.bulletStormSettings.lockableBullet;
     StartCoroutine(Scale_C());
 }
コード例 #4
0
 private void Awake()
 {
     bossDatas        = BossSettings.GetDatas();
     currentMaxLength = 0f;
     lr.startWidth    = bossDatas.laserSettings.chargingWidth;
     lr.endWidth      = bossDatas.laserSettings.chargingWidth;
     laserHitEffect.gameObject.SetActive(false);
 }
コード例 #5
0
ファイル: BossLeg.cs プロジェクト: ButterKane/Robot-emUp
 void Awake()
 {
     bossDatas       = BossSettings.GetDatas();
     weakPointRedDot = protectionPlateVisuals.transform.Find("WeakPointRed");
     weakPointRedDot.gameObject.SetActive(false);
     legAnimator                    = GetComponentInParent <ProceduralSpiderLegAnimator>();
     canonRetractedPosition         = canonVisuals.transform.localPosition;
     canonDeployedPosition          = canonRetractedPosition - new Vector3(canonLength, 0, 0);
     canonEnabled                   = false;
     protectionPlateInitialParent   = protectionPlateVisuals.transform.parent;
     protectionPlateInitialPosition = protectionPlateVisuals.transform.localPosition;
     protectionPlateInitialRotation = protectionPlateVisuals.transform.localRotation;
 }
コード例 #6
0
    private void Start()
    {
        if (characterController == null)
        {
            characterController = GetComponent <CharacterController>();
        }
        if (projectilePool == null)
        {
            projectilePool = GetComponent <Pool>();
        }

        settings = SettingsLoader.LoadSettings <BossSettings>();

        MaxHealth     = settings.Health;
        CurrentHealth = MaxHealth;

        SetBehaviour();
    }
コード例 #7
0
    public override void OnRestart(Vector3 pos)
    {
        base.OnRestart(pos);
        settings             = GetComponent <BossSettings> ();
        time_to_init_enemies = settings.time_to_init_enemies;
        GameObject assets = Instantiate(settings.assets);

        assets.transform.SetParent(transform);
        assets.transform.localPosition = Vector3.zero;
        parts = assets.GetComponentsInChildren <BossPart> ();

        foreach (BossPart part in parts)
        {
            part.gameObject.SetActive(false);
        }

        SetTotal(parts.Length);
        Init();
    }
コード例 #8
0
    public void AddComponentsToSceneObject(AreaSceneObjectData jsonData, GameObject so)
    {
        if (jsonData.soData.Count > 0)
        {
            SceneObjectDataGeneric data            = jsonData.soData [0];
            SceneObjectData        sceneObjectData = so.GetComponent <SceneObjectData> ();
            Bumper bumper = so.GetComponent <Bumper> ();

            if (data.bumperForce > 0)
            {
                if (bumper == null)
                {
                    bumper = so.gameObject.AddComponent <Bumper> ();
                }
                bumper.force = data.bumperForce;
            }
            if (data.size != Vector3.zero)
            {
                if (sceneObjectData == null)
                {
                    sceneObjectData = so.gameObject.AddComponent <SceneObjectData> ();
                }
                sceneObjectData.size = data.size;
            }
            if (data.random_pos_x != 0)
            {
                if (sceneObjectData == null)
                {
                    sceneObjectData = so.gameObject.AddComponent <SceneObjectData> ();
                }

                sceneObjectData.random_pos_x = data.random_pos_x;
            }
            if (data.minPayers != 0)
            {
                if (sceneObjectData == null)
                {
                    sceneObjectData = so.gameObject.AddComponent <SceneObjectData> ();
                }

                sceneObjectData.minPayers = data.minPayers;
            }
        }

        MaterialSwapper mat = so.GetComponent <MaterialSwapper>();

        if (mat != null && jsonData.mat.Count > 0)
        {
            MaterialChanger data = jsonData.mat[0];
            //if (mat == null)
            //    mat = so.gameObject.AddComponent<MaterialSwapper>();
            mat.Init(data.name);
        }

        FullRotation fullRotation = so.GetComponent <FullRotation> ();

        if (jsonData.fullRotationData.Count > 0)
        {
            FullRotationData data = jsonData.fullRotationData [0];

            if (fullRotation == null)
            {
                fullRotation = so.gameObject.AddComponent <FullRotation> ();
            }
            fullRotation.rotateX        = data.rotateX;
            fullRotation.rotateY        = data.rotateY;
            fullRotation.rotateZ        = data.rotateZ;
            fullRotation.speed          = data.speed;
            fullRotation.randomRotation = data.random;
        }
        else if (fullRotation != null)
        {
            fullRotation.OnComponentDisposed();
        }

        TimelineAnimation timelineAnimation = so.GetComponent <TimelineAnimation> ();

        if (jsonData.timelineAnimation.Count > 0)
        {
            TimelineAnimationData data = jsonData.timelineAnimation [0];
            if (timelineAnimation == null)
            {
                timelineAnimation = so.gameObject.AddComponent <TimelineAnimation> ();
            }
            timelineAnimation.timeLineData = data.timeLineData;
        }
        else if (timelineAnimation != null)
        {
            timelineAnimation.OnComponentDisposed();
        }

        if (jsonData.bossSettings.Count > 0)
        {
            BossSettingsData data         = jsonData.bossSettings [0];
            BossSettings     newcomponent = so.GetComponent <BossSettings> ();

            if (newcomponent == null)
            {
                newcomponent = so.gameObject.AddComponent <BossSettings> ();
            }

            newcomponent.bossModule           = data.bossModule;
            newcomponent.time_to_init_enemies = data.time_to_init_enemies;
            newcomponent.asset                 = data.asset;
            newcomponent.time_to_kill          = data.time_to_kill;
            newcomponent.distance_from_avatars = data.distance_from_avatars;
            newcomponent.bundle                = data.bundle;
        }
        if (jsonData.moveForward.Count > 0)
        {
            MoveForwardData data         = jsonData.moveForward [0];
            MoveForward     newcomponent = so.GetComponent <MoveForward> ();
            if (newcomponent == null)
            {
                newcomponent = so.gameObject.AddComponent <MoveForward> ();
            }
            newcomponent.speed           = data.speed;
            newcomponent.randomSpeedDiff = data.randomSpeedDiff;
            newcomponent.moveBackIn      = data.moveBackIn;
        }
    }
コード例 #9
0
    public void AddComponentsToJson(AreaSceneObjectData newSOdata, GameObject go)
    {
        FullRotation      fullRotation      = go.GetComponent <FullRotation> ();
        MaterialSwapper   mat               = go.GetComponent <MaterialSwapper>();
        TimelineAnimation timelineAnimation = go.GetComponent <TimelineAnimation> ();
        BossSettings      bossSettings      = go.GetComponent <BossSettings> ();
        MoveForward       moveForward       = go.GetComponent <MoveForward> ();
        Bumper            bumper            = go.GetComponent <Bumper> ();
        SceneObjectData   soData            = go.GetComponent <SceneObjectData> ();

        if (newSOdata.name == "wallSmall")
        {
            newSOdata.mat = new List <MaterialChanger>();
            MaterialChanger mc = new MaterialChanger();
            mc.name = go.GetComponent <MeshRenderer>().sharedMaterial.ToString().Split(" "[0])[0];
            newSOdata.mat.Add(mc);
        }

        if (soData != null)
        {
            newSOdata.soData = new List <SceneObjectDataGeneric> ();
            SceneObjectDataGeneric data = new SceneObjectDataGeneric();
            data.size         = soData.size;
            data.random_pos_x = soData.random_pos_x;
            data.minPayers    = soData.minPayers;
            data.minPayers    = soData.minPayers;
            newSOdata.soData.Add(data);
        }
        if (bumper != null)
        {
            newSOdata.soData = new List <SceneObjectDataGeneric> ();
            SceneObjectDataGeneric data = new SceneObjectDataGeneric();
            data.bumperForce = bumper.force;
            newSOdata.soData.Add(data);
        }
        if (fullRotation != null)
        {
            newSOdata.fullRotationData = new List <FullRotationData> ();
            FullRotationData data = new FullRotationData();
            data.rotateX = fullRotation.rotateX;
            data.rotateY = fullRotation.rotateY;
            data.rotateZ = fullRotation.rotateZ;
            data.speed   = fullRotation.speed;
            data.random  = fullRotation.randomRotation;
            newSOdata.fullRotationData.Add(data);
        }
        if (timelineAnimation != null)
        {
            newSOdata.timelineAnimation = new List <TimelineAnimationData> ();
            TimelineAnimationData data = new TimelineAnimationData();
            data.timeLineData = timelineAnimation.timeLineData;
            newSOdata.timelineAnimation.Add(data);
        }
        if (bossSettings != null)
        {
            newSOdata.bossSettings = new List <BossSettingsData> ();
            BossSettingsData data = new BossSettingsData();
            data.bossModule            = bossSettings.bossModule;
            data.asset                 = bossSettings.asset;
            data.time_to_init_enemies  = bossSettings.time_to_init_enemies;
            data.time_to_kill          = bossSettings.time_to_kill;
            data.distance_from_avatars = bossSettings.distance_from_avatars;
            data.bundle                = bossSettings.bundle;
            newSOdata.bossSettings.Add(data);
        }
        if (moveForward != null)
        {
            newSOdata.moveForward = new List <MoveForwardData> ();
            MoveForwardData data = new MoveForwardData();
            data.speed           = moveForward.speed;
            data.randomSpeedDiff = moveForward.randomSpeedDiff;
            data.moveBackIn      = moveForward.moveBackIn;
            newSOdata.moveForward.Add(data);
        }
    }
コード例 #10
0
 private void GetReferences()
 {
     bossDatas = BossSettings.GetDatas();
     navMesh   = GetComponent <NavMeshAgent>();
 }
コード例 #11
0
    public void replaceSceneObject(Area area, float areasLength, int areasX, bool oposite = false)
    {
        print(area.name + " AREA");
        borderTransforms = new List <Transform> ();
        this.area        = area;
        GameObject[] gos     = area.getSceneObjects();
        bool         nubesOn = false;

        foreach (GameObject go in gos)
        {
            SceneObject sceneObject = null;
            Vector3     pos         = go.transform.position;
            pos.z += areasLength;
            pos.x += areasX;
            if (oposite)
            {
                pos.z *= -1;
            }


            //  if (!nubesOn)
            //  {
            //  nubesOn = true;
            //   addDecoration("Nubes_real", pos, new Vector3(0, Random.Range(0,2), 5));

            //  }

            switch (go.name)
            {
            case "extralargeBlock1":
            case "flyer":
            case "largeBlock1":
            case "mediumBlock1":
            case "smallBlock1":
            case "extraSmallBlock1":
            case "Coin":
            case "bloodx1":
            //case "Yuyo":
            case "enemyFrontal":
            case "enemyWater":
            case "enemySide":
            case "enemyBack":
            case "castle":
            case "SideMountain":
            case "bonusEntrance":
            case "Cascade":
            case "firewall":
            case "Baranda1":
            case "Tumba":
            case "enemyNaveSimple":

                if (go.name == "smallBlock1" || go.name == "extraSmallBlock1")
                {
                    sceneObject = Pool.GetObjectForType(go.name + "_real", true);
                }
                else
                {
                    sceneObject = Pool.GetObjectForType(go.name + "_real", false);
                }

                if (sceneObject)
                {
                    sceneObject.isActive = false;
                    sceneObject.Restart(pos);
                    sceneObject.transform.rotation = go.transform.rotation;

                    //if (go.name == "Yuyo")
                    //	sceneObject.SetMaterialByVideoGame ();

                    //sceneObject.changeMaterial("pasto");

                    if (go.name == "extralargeBlock1")
                    {
                        //GameObject goNew = new GameObject ();
                        //goNew.transform.position = pos;
                        //goNew.transform.rotation = go.transform.rotation;
                        //borderTransforms.Add (goNew.transform);

//						int num = Random.Range(1, 4);
//						string decorationName = "";
//						if (num == 1)
//							decorationName = "flores1_real";
//						if (num == 2)
//							decorationName = "flores2_real";
//						else if (num == 3)
//							decorationName = "floorFlowers_real";
//
//						if (decorationName != "")
//							addDecoration(decorationName, pos, Vector3.zero);
                    }
                    //  }
                    if (go.GetComponent <DecorationManager>())
                    {
                        addDecoration("Baranda1_real", pos, new Vector3(5.5f, 0, 3));
                        addDecoration("Baranda1_real", pos, new Vector3(-5.5f, 0, 3));
                        addDecoration("Baranda1_real", pos, new Vector3(5.5f, 0, -3));
                        addDecoration("Baranda1_real", pos, new Vector3(-5.5f, 0, -3));
                    }
                }
                else
                {
                    Debug.LogError("___________NO EXISTIO EL OBJETO: " + go.name);
                    Data.Instance.events.ForceFrameRate(0);
                }
                break;
            }



            SceneObject clone = null;


            if (go.name == "FloorSurface")
            {
                clone = FloorSurface;
            }
            if (go.name == "PisoPinche")
            {
                clone = PisoPinche;
            }
            else if (go.name == "house1")
            {
                clone = house1;
            }
            else if (go.name == "house2")
            {
                clone = house2;
            }
            else if (go.name == "house3")
            {
                clone = house3;
            }
            else if (go.name == "house4")
            {
                clone = house4;
            }
            else if (go.name == "rampa")
            {
                clone = rampa;
            }
            else if (go.name == "rampaHuge")
            {
                clone = rampaHuge;
            }
            else if (go.name == "wallBig")
            {
                //  addDecorationWithRotation("Graffiti_Real", pos, go.transform.localEulerAngles);
                clone = wallBig;
            }
            else if (go.name == "wallMedium")
            {
                clone = wallMedium;
            }
            else if (go.name == "wallSmall")
            {
                clone = wallSmall;
            }
            else if (go.name == "wallSuperSmall")
            {
                clone = wallSuperSmall;
            }
            else if (go.name == "jumper")
            {
                clone = jumper;
            }
            else if (go.name == "Lava")
            {
                clone = Lava;
            }
            else if (go.name == "Water")
            {
                clone = Water;
            }
            else if (go.name == "Boss1")
            {
                clone = Boss1;
            }
            else if (go.name == "Boss2")
            {
                clone = Boss2;
            }
            else if (go.name == "BossCalecitas1")
            {
                clone = BossCalecitas1;
            }
            else if (go.name == "BossCreator")
            {
                clone = BossCreator;
            }
            else if (go.name == "BossSpace1")
            {
                clone = BossSpace1;
            }
            else if (go.name == "BossPacmans")
            {
                clone = BossPacmans;
            }
            else if (go.name == "BossGalaga")
            {
                clone = BossGalaga;
            }
            else if (go.name == "BossPacmansIntro")
            {
                clone = BossPacmansIntro;
            }
            else if (go.name == "Calecita")
            {
                clone = Calecita;
            }
            else if (go.name == "Starting")
            {
                clone = Starting;
            }
            else if (go.name == "bomb1")
            {
                clone = bomb1;
            }
            else if (go.name == "tunel1")
            {
                clone = tunel1;
            }
            else if (go.name == "tunel2")
            {
                clone = tunel2;
            }
            else if (go.name == "cilindro")
            {
                clone = cilindro;
            }
            else if (go.name == "enemyGhost")
            {
                clone = enemyGhost;
            }
            else if (go.name == "palmTall")
            {
                clone = palm_tall;
                go.transform.localEulerAngles = new Vector3(0, Random.Range(0, 4) * 90, 0);
            }
            else if (go.name == "palm")
            {
                int ran = Random.Range(0, 60);
                if (ran < 20)
                {
                    clone = palm;
                }
                else if (ran < 40)
                {
                    clone = palm2;
                }
                else
                {
                    clone = palm3;
                }

                go.transform.localEulerAngles = new Vector3(0, Random.Range(0, 4) * 90, 0);
                //}
            }
            else if (go.name == "streetFloor")
            {
                clone = streetFloor;
            }
            else if (go.name == "streetFloorSmall")
            {
                clone = streetFloorSmall;
            }
            else if (go.name == "levelSignal")
            {
                clone = levelSignal;
            }
            else if (go.name == "GrabbableJetpack")
            {
                clone = GrabbableJetpack;
            }
            else if (go.name == "GrabbableInvensible")
            {
                clone = GrabbableInvensible;
            }
            else if (go.name == "borde1")
            {
                clone = borde1;
            }
            else if (go.name == "fences")
            {
                clone = fences;
            }
            else if (go.name == "rainbow")
            {
                clone = rainbow;
            }
            else if (go.name == "Listener")
            {
                clone = Listener;
            }
            else if (go.name == "cruz")
            {
                clone = cruz;
            }
            else if (go.name == "CruzGrande")
            {
                clone = CruzGrande;
            }
            else if (go.name == "rueda1")
            {
                clone = rueda1;
            }
            else if (go.name == "helice1")
            {
                clone = helice1;
            }
            else if (go.name == "helice2")
            {
                clone = helice2;
            }
            else if (go.name == "subibaja")
            {
                clone = subibaja;
            }
            else if (go.name == "cepillo")
            {
                clone = cepillo;
            }
            else if (go.name == "pisoRotatorio")
            {
                clone = pisoRotatorio;
            }
            else if (go.name == "sombrilla")
            {
                clone = sombrilla;
            }
            else if (go.name == "GrabbableMissile")
            {
                clone = GrabbableMissile;
            }
            else if (go.name == "FloorSlider")
            {
                clone = FloorSlider;
            }


            if (clone)
            {
                sceneObject = Instantiate(clone, pos, Quaternion.identity) as SceneObject;
                sceneObject.transform.parent   = Pool.Scene.transform;
                sceneObject.transform.rotation = go.transform.rotation;

                if (go.GetComponent <BossSettings>())
                {
                    BossSettings mo = go.GetComponent <BossSettings>();
                    CopyComponent(mo, sceneObject.gameObject);
                }

                sceneObject.Restart(pos);
            }
            if (go.GetComponent <Move>() && sceneObject.GetComponent <Move>() == null)
            {
                Move mo = go.GetComponent <Move>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <MoveObject>())
            {
                MoveObject mo = go.GetComponent <MoveObject>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <Dropper>())
            {
                Dropper mo = go.GetComponent <Dropper>();
                CopyComponent(mo, sceneObject.gameObject);
            }

            if (go.GetComponent <EnemyPathRunnerBehavior>())
            {
                EnemyPathRunnerBehavior mo = go.GetComponent <EnemyPathRunnerBehavior>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <EnemyShooter>())
            {
                EnemyShooter mo = go.GetComponent <EnemyShooter>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <EnemyRunnerBehavior>())
            {
                EnemyRunnerBehavior mo = go.GetComponent <EnemyRunnerBehavior>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <Jump>())
            {
                Jump mo = go.GetComponent <Jump>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <EnemyPathsMultiples>())
            {
                EnemyPathsMultiples mo = go.GetComponent <EnemyPathsMultiples>();
                CopyComponent(mo, sceneObject.gameObject);
            }



            if (go.GetComponent <Subibaja>())
            {
                Subibaja mo = go.GetComponent <Subibaja>();
                CopyComponent(mo, sceneObject.gameObject);
            }

            if (go.GetComponent <ListenerDispatcher>())
            {
                ListenerDispatcher mo = go.GetComponent <ListenerDispatcher>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <FlyingBehavior>())
            {
                FlyingBehavior mo = go.GetComponent <FlyingBehavior>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <FullRotation>())
            {
                FullRotation mo = go.GetComponent <FullRotation>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <Bumper>())
            {
                Bumper mo = go.GetComponent <Bumper>();
                CopyComponent(mo, sceneObject.gameObject);
            }
            if (go.GetComponent <RandomPosition>())
            {
                RandomPosition mo = go.GetComponent <RandomPosition>();
                pos = mo.getPosition(pos);
            }
        }
        //AddBorders ();
    }
コード例 #12
0
 public override void OnRestart(Vector3 pos)
 {
     settings = GetComponent <BossSettings> ();
     StartCoroutine(DoSequence());
     base.OnRestart(pos);
 }
コード例 #13
0
 private void Awake()
 {
     bossDatas = BossSettings.GetDatas();
     StartCoroutine(DestroyAfterDelay_C(bossDatas.laserSettings.duration));
 }
コード例 #14
0
ファイル: BossTile.cs プロジェクト: ButterKane/Robot-emUp
 private void Awake()
 {
     bossSettings = BossSettings.GetDatas();
 }