Beispiel #1
0
        private void Awake()
        {
            _anim     = GetComponent <tk2dSpriteAnimator>();
            _audio    = GetComponent <AudioSource>();
            _collider = GetComponent <BoxCollider2D>();
            _hm       = GetComponent <HealthManager>();
            _nb       = GetComponent <NonBouncer>();
            _rb       = GetComponent <Rigidbody2D>();

            _hc   = HeroController.instance;
            _ac   = _hc.GetAttr <HeroController, HeroAudioController>("audioCtrl");
            _hero = _hc.gameObject;
            _sc   = _hc.spellControl;
            _pd   = PlayerData.instance;

            _musicObj = new GameObject("Doppelganger Music");

            _maxHealth = 2000 + (_pd.maxHealth + _pd.healthBlue) * 200;
            _hm.hp     = _maxHealth;

            #if DEBUG
            //_hm.hp = 1000;
            #endif

            _furyThreshold = _hm.hp / 10;

            _hm.OnDeath += OnDeath;
            HeroController.instance.OnDeath += OnHeroDeath;
            On.HealthManager.TakeDamage     += OnTakeDamage;
            On.MusicCue.GetChannelInfo      += MusicCueGetChannelInfo;
        }
Beispiel #2
0
        public override void Initialize()
        {
            GameObject go = new GameObject();

            _coroutineStarter = go.AddComponent <NonBouncer>();
            Object.DontDestroyOnLoad(_coroutineStarter);

            UnityEngine.SceneManagement.SceneManager.sceneLoaded += StartRoutine;
        }
            public PlandoCompatibility()
            {
                CheckPlando();

                var go = new GameObject();

                _coroutineStarter = go.AddComponent <NonBouncer>();

                UObject.DontDestroyOnLoad(go);
            }
        public static void SetupCanvas()
        {
            _canvas = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceCamera, new Vector2(1920, 1080));
            UnityEngine.Object.DontDestroyOnLoad(_canvas);

            GameObject go = new GameObject();

            _coroutineStarter = go.AddComponent <NonBouncer>();
            UnityEngine.Object.DontDestroyOnLoad(go);
        }
        private void SpawnHitboxes()
        {
            if (!GameManager.instance.IsGameplayScene())
            {
                return;
            }

            foreach (Collider2D col in lines.Keys.ToArray())
            {
                if (col != null && lines[col] != null)
                {
                    Object.Destroy(lines[col].gameObject);
                }
            }

            colliders = new List <Collider2D>();
            lines     = new Dictionary <Collider2D, LineRenderer>();

            foreach (Collider2D col in Object.FindObjectsOfType <Collider2D>())
            {
                if (colliders.Contains(col))
                {
                    continue;
                }

                if (col.gameObject.layer == (int)PhysLayers.TERRAIN)
                {
                    lines.Add(col, SetupLineRenderer(col, null, greenMat));
                }
                else if (col.GetComponent <TransitionPoint>())
                {
                    lines.Add(col, SetupLineRenderer(col, null, blueMat));
                }
                else if (col.GetComponent <DamageHero>())
                {
                    colliders.Add(col);
                    lines.Add(col, SetupLineRenderer(col, null, redMat));
                }
                else if (col.gameObject == HeroController.instance.gameObject && !col.isTrigger)
                {
                    colliders.Add(col);
                    lines.Add(col, SetupLineRenderer(col, null, yellowMat));
                }
                else if (col.GetComponent <Breakable>())
                {
                    NonBouncer bounce = col.GetComponent <NonBouncer>();
                    if (bounce == null || !bounce.active)
                    {
                        colliders.Add(col);
                        lines.Add(col, SetupLineRenderer(col, null, blueMat));
                    }
                }
            }
        }
        // Has side effect of making some things pogoable which originally were not; i.e. enemy death explosions
        private static GameObject FixExplosionPogo(GameObject go)
        {
            if (!go.name.StartsWith("Gas Explosion Recycle M"))
            {
                return(go);
            }

            go.layer = (int)PhysLayers.ENEMIES;
            NonBouncer noFun = go.GetComponent <NonBouncer>();

            if (noFun)
            {
                noFun.active = false;
            }

            return(go);
        }
Beispiel #7
0
        private void Awake()
        {
            gameObject.name = "Cagney Carnation";

            _control = gameObject.LocateMyFSM("Control");

            _hornet = CagneyCarnation.GameObjects["Hornet"];

            _de = gameObject.AddComponent <EnemyDeathEffectsUninfected>();
            _hm = gameObject.AddComponent <HealthManager>();
            _sf = gameObject.AddComponent <SpriteFlash>();
            _he = gameObject.AddComponent <EnemyHitEffectsUninfected>();
            _nb = GetComponent <NonBouncer>();

            AssignFields();

            On.HealthManager.TakeDamage += OnTakeDamage;
        }