Beispiel #1
0
 private void SetWave(byte wave, ZombieType zombieType, ushort shtAmount)
 {
     if (wave > 0)
     {
         spawnTable[wave - 1][(byte)zombieType] = shtAmount;
     }
 }
    // Returns a random spawn location for the zombie to spawn at
    private Vector2 GetRandomSpawnLocation(ZombieType type)
    {
        switch (type)
        {
        case ZombieType.falling:
            return(new Vector2(Random.Range(spawnXClamp.x, spawnXClamp.y), transform.position.y));

        case ZombieType.window:
            GameObject tempObject = WindowManager.instance.GetSpawnableWindow(true);
            if (tempObject)
            {
                return(tempObject.transform.position);
            }
            break;

        case ZombieType.zombieCheck:
            GameObject testObject = WindowManager.instance.GetSpawnableWindow();
            if (testObject)
            {
                return(testObject.transform.position);
            }
            break;
        }
        Debug.Log("There was no zombie type given.");
        return(Vector2.zero);
    }
Beispiel #3
0
    // Sets up all variable for the zombie
    public void Setup(ZombieType _type, float _attackSpeed, float _fallSpeed)
    {
        type        = _type;
        attackSpeed = _attackSpeed;
        fallSpeed   = _fallSpeed;
        animator    = GetComponent <Animator>();
        // Instantiate an indicatior that is turned off after a few seconds
        if (type == ZombieType.falling)
        {
            GetComponent <Animator>().SetBool("isFalling", true);
            indicator   = Instantiate(indicatorPrefab, fallingIndicatorTrans.position, Quaternion.identity);
            zombieColor = Random.Range(0f, 100f) <= 50 ? "green" : "red";
            switch (zombieColor)
            {
            case "green":
                GetComponent <Animator>().SetBool("isRed", false);
                break;

            case "red":
                GetComponent <Animator>().SetBool("isRed", true);
                break;
            }
        }
        else
        {
            GetComponent <SpriteRenderer>().sortingOrder = 2;
            GetComponent <Animator>().SetBool("isFalling", false);
            indicator = Instantiate(indicatorPrefab, transform.position, Quaternion.identity);
        }
    }
Beispiel #4
0
    void CreatOneZombie(ZombieType type)
    {
        GameObject zombie = null;

        switch (type)
        {
        case ZombieType.Zombie1:
            zombie = Instantiate(zombie1);
            break;

        case ZombieType.ConeHeadZombie:
            zombie = Instantiate(ConeheadZombie);
            break;

        case ZombieType.BucketHeadZombie:
            zombie = Instantiate(BucketheadZombie);
            break;
        }


        int row = Random.Range(0, StageMap.ROW_MAX);

        zombie.transform.position = StageMap.SetZombiePos(row);
        zombie.GetComponent <ZombieMove>().row = row;
        zombie.GetComponent <SpriteDisplay>().SetOrderByRow(row);
        model.zombieList[row].Add(zombie);
    }
    public Zombie SpawnZombie(ZombieType type)
    {
        var newZombie = Instantiate(zombiePrefab).GetComponent <Zombie>();

        newZombie.ZombieData = zombieDatas[(int)type];
        return(newZombie);
    }
Beispiel #6
0
    private void SetAliveModel(ZombieType zt, bool alive)
    {
        bool big  = zt == ZombieType.Life;
        bool fast = zt == ZombieType.Speed;
        bool norm = zt == ZombieType.Normal;

        foreach (var a in DeadZombie.GetComponentsInChildren <Renderer>())
        {
            a.enabled = norm && !alive;
        }
        foreach (var a in AliveZombie.GetComponentsInChildren <Renderer>())
        {
            a.enabled = norm && alive;
        }
        foreach (var a in BigZombie.GetComponentsInChildren <Renderer>())
        {
            a.enabled = big && alive;
        }
        foreach (var a in BigDeadZombie.GetComponentsInChildren <Renderer>())
        {
            a.enabled = big && !alive;
        }
        foreach (var a in FastZombie.GetComponentsInChildren <Renderer>())
        {
            a.enabled = fast && alive;
        }
        foreach (var a in FastDeadZombie.GetComponentsInChildren <Renderer>())
        {
            a.enabled = fast && !alive;
        }
    }
Beispiel #7
0
 public SpawnInfo(ZombieType type, int count, float spawnRate, float spawnDelay)
 {
     this.type       = type;
     this.count      = count;
     this.spawnRate  = spawnRate;
     this.spawnDelay = spawnDelay;
 }
Beispiel #8
0
    }//findTargetDirection

    //evolve to the next zombie
    public void evolve()
    {
        if (zombieType != freak)
        {
            zombieType += 1;
        }
        updateZombieAttribute();
    }//evolve
Beispiel #9
0
 public void StartTestBossWave(ZombieType bossType)
 {
     _lastBossAlive = false;
     _zombies.Clear();
     _GOfactory.DebugClear();
     _testBossType = bossType;
     StartNewWave(WaveType.TestBoss);
 }
Beispiel #10
0
        private void SpawnZombie(ZombieType type)
        {
            // Set-up the user to follow.

            // Add zombie to the table :)

            // Send spawn packet to the players.
            //send(new SP_SPAWN_ZOMBIE(Zombie.ID, Zombie.FollowUser, ZombieSpawnPlace, Type));
        }
Beispiel #11
0
    public Zombie(ZombieType typeIn)
    {
        zombieType = typeIn;
        updateZombieAttribute(); //Will this work? or the instance has to be created first?
        followTime = 0;
        currentTarget = null;

        //Might not need this
        currentPosition = new int[2];
    }
Beispiel #12
0
    public Zombie(ZombieType typeIn)
    {
        zombieType = typeIn;
        updateZombieAttribute(); //Will this work? or the instance has to be created first?
        followTime    = 0;
        currentTarget = null;

        //Might not need this
        currentPosition = new int[2];
    }    //constructor
Beispiel #13
0
    private void ChangeMainZombieType()
    {
        Debug.Log("ChangeMainZombieType");
        ZombieType main  = _currentMainZombieType;
        int        index = UnityEngine.Random.Range(0, _otherMainTypes.Count);

        _currentMainZombieType = _otherMainTypes[index];
        _otherMainTypes.Remove(_currentMainZombieType);
        _otherMainTypes.Add(main);
        SetDirty();
    }
        private TextureDefinition GetTexture(ZombieType zombieType)
        {
            switch (zombieType)
            {
                case ZombieType.GoldenGoblin:
                    return _contentProvider.DefaultManager.LoadTexture("ZombieWhite");

                default:
                    return SkypieaViewConstants.LoadTexture(_contentProvider, "Zombie");
            }
        }
Beispiel #15
0
    protected override void OnDeserialize(JsonObject json)
    {
        _otherMainTypes.Clear();
        _autoStartNewWave = false;

        _currentWaveHP.Deserialize((JsonObject)json["waveHP"]);
        _currentDecadeStartHP.Deserialize((JsonObject)json["decadeHP"]);
        _hpPerZombie.Deserialize((JsonObject)json["hpPerZombie"]);
        _currentZombieCount       = json.GetInt("zombieCount");
        _currentDecadeZombieCount = json.GetInt("decadeCount");
        WaveNumber = json.GetInt("waveNumber");

        string mainTypeString = json.GetString("mainType");

        _currentMainZombieType = Helper.ParseEnum <ZombieType>(mainTypeString, ZombieType.Unknown);

        JsonArray array = (JsonArray)json["otherMainTypes"];

        for (int i = 0; i < array.Count; i++)
        {
            string     str       = (string)array[i];
            ZombieType otherType = Helper.ParseEnum <ZombieType>(str, ZombieType.Unknown);
            _otherMainTypes.Add(otherType);
        }

        array = (JsonArray)json["otherAddTypes"];
        for (int i = 0; i < array.Count; i++)
        {
            string     str       = (string)array[i];
            ZombieType otherType = Helper.ParseEnum <ZombieType>(str, ZombieType.Unknown);
            _otherAddTypes.Add(otherType);
        }

        array = (JsonArray)json["zombies"];
        for (int i = 0; i < array.Count; i++)
        {
            JsonObject zombieJson = (JsonObject)array[i];
            Zombie     zombie     = _zombiePool.GetZombieModel(zombieJson);
            _zombies.Add(zombie);
        }

        _lastBossAlive = json.GetBool("lastBossAlive");

        DateTime now    = DateTime.UtcNow;
        DateTime oldNow = Helper.FromUnixTimeMs((long)json["now"]);

        if (CanChangeMainType(now, oldNow))
        {
            ChangeMainZombieType();
        }

        _onWaveStartedSignal.Fire(WaveNumber, InfInt.Zero, _currentMainZombieType);
    }
Beispiel #16
0
    public void CreateZombie(int stage)
    {

        zombieType = priority.Random();
        var speed = zombieSpeedCurve.Evaluate(stage);
        speed = Random.Range(speed, speed * .8f);
        var life = zombieLifeCurve.Evaluate(stage) * _Game.mapSettings.zombieLifeFactor;
        life = Random.Range(life, life * .3f);
        if (zombieType == ZombieType.Life) { speed *= .7f; life *= 5; }
        if (zombieType == ZombieType.Speed) { speed *= 1.5f; life *= .7f; }
        RPCSetup(speed, life, (int)zombieType);
    }
Beispiel #17
0
 public void SetZombieType(ZombieType type)
 {
     // go query the zombie type manager for our stats
     stats      = ZombieManager.GetStatsForType((int)type);
     zombieType = type;
     // query the zombie manager for the material
     this.GetComponent <MeshRenderer> ().sharedMaterial = ZombieManager.GetMaterialForType((int)type);
     // get the scale too
     thisTransform.localScale = ZombieManager.GetScaleForType((int)type);
     // set the nucleus multiplier speed
     nucleus.multiplier = stats.speed;
 }
Beispiel #18
0
        public ZombieShip(Game game, GameScreen screen, Vector2 position, ZombieType type)
            : base(game, screen, position)
        {
            this.random = new Random();

            this.Layer = Layer.ZOMBIE;

            this.type = type;

            switch (this.type)
            {
            case ZombieType.FLOATER:
                this.width            = 58;
                this.height           = 76;
                zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/paraZombie", width, height, 4, 5);
                zombieAnimationFlying.EnableRepeating();
                this.Velocity   = new Vector2(0, 1 + this.NextFloat());
                this.pointValue = 5;
                break;

            case ZombieType.SHOOTER:
                this.width            = 30;
                this.height           = 17;
                zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/zombieShip", width, height, 2, 15);
                zombieAnimationFlying.EnableRepeating();
                this.Velocity   = new Vector2(-1 * (2 + 4 * this.NextFloat()), 0);
                this.pointValue = 10;
                break;

            case ZombieType.SLAMMER:
                this.width            = 32;
                this.height           = 17;
                zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/kamakazi", width, height, 2, 15);
                zombieAnimationFlying.EnableRepeating();
                this.Velocity   = new Vector2(0, -9 * (1 + 2 * this.NextFloat()));
                this.pointValue = 25;
                break;

            case ZombieType.CANNON:
                this.width            = 32;
                this.height           = 22;
                zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/bomberZombie", width, height, 8, 5);
                zombieAnimationFlying.EnableRepeating();
                Vector2 diff = Vector2.Subtract(this.Position, this.Screen.Player.Position);
                this.Velocity   = new Vector2(-10, -0.5f - (diff.Y / 30) - (diff.X / 120));
                this.pointValue = 5;
                break;
            }

            this.ResetTimer();
        }
Beispiel #19
0
    // get the speed of the zombie according to the type
    public float getSpeed(ZombieType t)
    {
        switch (t)
        {
        case ZombieType.SHAMBLER:
            return(speed / 2);

        case ZombieType.MODERN:
            return(speed * 2);

        default:
            return(speed);
        }
    }
Beispiel #20
0
        public ZombieShip(Game game, GameScreen screen, Vector2 position, ZombieType type)
            : base(game, screen, position)
        {
            this.random = new Random();

            this.Layer = Layer.ZOMBIE;

            this.type = type;

            switch (this.type)
            {
                case ZombieType.FLOATER:
                    this.width = 58;
                    this.height = 76;
                    zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/paraZombie", width, height, 4, 5);
                    zombieAnimationFlying.EnableRepeating();
                    this.Velocity = new Vector2(0, 1 + this.NextFloat());
                    this.pointValue = 5;
                    break;
                case ZombieType.SHOOTER:
                    this.width = 30;
                    this.height = 17;
                    zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/zombieShip", width, height, 2, 15);
                    zombieAnimationFlying.EnableRepeating();
                    this.Velocity = new Vector2(-1 * (2 + 4 * this.NextFloat()), 0);
                    this.pointValue = 10;
                    break;
                case ZombieType.SLAMMER:
                    this.width = 32;
                    this.height = 17;
                    zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/kamakazi", width, height, 2, 15);
                    zombieAnimationFlying.EnableRepeating();
                    this.Velocity = new Vector2(0, -9 * (1 + 2 * this.NextFloat()));
                    this.pointValue = 25;
                    break;
                case ZombieType.CANNON:
                    this.width = 32;
                    this.height = 22;
                    zombieAnimationFlying = new Animation(this.Game.Content, "Sprites/bomberZombie", width, height, 8, 5);
                    zombieAnimationFlying.EnableRepeating();
                    Vector2 diff = Vector2.Subtract(this.Position, this.Screen.Player.Position);
                    this.Velocity = new Vector2(-10, - 0.5f - (diff.Y / 30) - (diff.X / 120));
                    this.pointValue = 5;
                    break;
            }

            this.ResetTimer();
        }
Beispiel #21
0
    public void Setup(float zombiespeed, float zombieLife, int priority)
    {
        Alive = true;

        Sync = true;
        ResetSpawn();
        SetLayer(gameObject);
        _TimerA.AddMethod(UnityEngine.Random.Range(0, 1000), PlayRandom);
        zombieType = (ZombieType)priority;
        SetAliveModel(zombieType, true);

        speed   = zombiespeed;
        MaxLife = Life = zombieLife;
        transform.localScale = Vector3.one * Math.Min(Mathf.Max(Mathf.Sqrt(zombieLife) / 10, 1f), 3);
        slowdowntime         = .2f / transform.localScale.x;
    }
Beispiel #22
0
    public ZombieManager(ZombieDiedSignal zombieDiedSignal, ZombiePool zombiePool,
                         ZombieFactory goFactory, GameConfig gameConfig, StartNewWaveSignal startNewWave,
                         WaveStartedSignal waveStarted, UpdateZombiesCountSignal onUpdateZombiesCountSignal,
                         NightManager nightManager, WindowsManager windowsManager, ZombieConfig zombieConfig,
                         TutorialManager tutorialManager, AnalyticsManager analyticsManager) : base("zombies.json")
    {
        _onZombieDiedSignal            = zombieDiedSignal;
        _onStartNewWaveSignal          = startNewWave;
        _onWaveStartedSignal           = waveStarted;
        _onUpdateZombiesCountSignal    = onUpdateZombiesCountSignal;
        _windowsManager                = windowsManager;
        _tutorialManager               = tutorialManager;
        _tutorialManager.ZombieManager = this;
        _analyticsManager              = analyticsManager;

        _zombiePool   = zombiePool;
        _GOfactory    = goFactory;
        _gameConfig   = gameConfig;
        _nightManager = nightManager;
        _zombieConfig = zombieConfig;

        _zombies = new List <Zombie>();
        _zombieCountBeforeBoss    = _gameConfig.waveSettings.startZombieCount;
        _currentZombieCount       = _zombieCountBeforeBoss;
        _currentDecadeZombieCount = _gameConfig.waveSettings.startZombieCount;
        WaveNumber             = _gameConfig.waveSettings.startWave;
        _currentMainZombieType = ZombieType.Basic;
        _otherMainTypes        = new List <ZombieType>();
        _otherMainTypes.Add(ZombieType.Acid);
        _otherMainTypes.Add(ZombieType.Fire);
        _otherMainTypes.Add(ZombieType.Armor);
        _otherMainTypes.Add(ZombieType.Electro);

        _otherAddTypes = new List <ZombieType>();

        _hpPerZombie          = new InfInt();
        _currentDecadeStartHP = new InfInt(_gameConfig.waveSettings.firstWaveHP);
        _currentWaveHP        = new InfInt(_currentDecadeStartHP);

        _tempBigNumber = new InfInt();
        _tmpBigNumber  = new InfInt();

        _autoStartNewWave    = false;
        _waveStarted         = false;
        _timeTravelStartLock = false;
        _lastBossAlive       = false;
    }
Beispiel #23
0
    // 빌려간거 다시 돌려줌
    public void returnObj(GameObject obj, ZombieType zombieType)
    {
        ZombieGroupMaker ZGM = obj.transform.GetChild(3).GetComponent <ZombieGroupMaker>();

        ZGM.decreaseScore(obj.transform.GetChild(3).gameObject);

        obj.SetActive(false);

        if (zombieType == ZombieType.normalAI)
        {
            poolingNormalZombie.Enqueue(obj);
        }
        else
        {
            poolingSmartZombie.Enqueue(obj);
        }
    }
Beispiel #24
0
    void CreateOneZombie(ZombieType type)
    {
        GameObject zombie;

        switch (type)
        {
        case ZombieType.Zombie1:
            zombie = Instantiate(Zombie1);
            break;

        case ZombieType.Zombie2:
            zombie = Instantiate(Zombie2);
            break;

        case ZombieType.FlagZombie:
            zombie = Instantiate(FlagZombie);
            break;

        case ZombieType.ConeheadZombie:
            zombie = Instantiate(ConeheadZombie);
            break;

        case ZombieType.BucketheadZombie:
            zombie = Instantiate(BucketheadZombie);
            break;

        case ZombieType.PoleVaultingZombie:
            zombie = Instantiate(PoleVaultingZombie);
            break;

        case ZombieType.NewspaperZombie:
            zombie = Instantiate(NewspaperZombie);
            break;

        default:
            throw new System.Exception("Wrong zombie type");
        }
        int row = Random.Range(0, StageMap.ROW_MAX - 1);

        zombie.transform.position              = StageMap.GetZombiePos(row);
        zombie.transform.localScale            = new Vector3(0.5f, 0.5f, 0.5f);
        zombie.GetComponent <ZombieMove>().row = row;
        zombie.GetComponent <SpriteDisplay>().SetOrderByRow(row);
        model.zombieList[row].Add(zombie);
    }
Beispiel #25
0
        public static int GetScore(ZombieType type)
        {
            switch (type)
            {
                case ZombieType.Normal:
                    return 100;
                case ZombieType.Fat:
                    return 200;

                case ZombieType.Rusher:
                    return 150;

                case ZombieType.GoldenGoblin:
                    return 0; // the score from golden goblin in GoldenGoblinRewardSystem (tms)

                default:
                    return 100;
            }
        }
Beispiel #26
0
    public void CreateZombie(int stage)
    {
        zombieType = priority.Random();
        var speed = zombieSpeedCurve.Evaluate(stage);

        speed = Random.Range(speed, speed * .8f);
        var life = zombieLifeCurve.Evaluate(stage) * _Game.mapSettings.zombieLifeFactor;

        life = Random.Range(life, life * .3f);
        if (zombieType == ZombieType.Life)
        {
            speed *= .7f; life *= 5;
        }
        if (zombieType == ZombieType.Speed)
        {
            speed *= 1.5f; life *= .7f;
        }
        RPCSetup(speed, life, (int)zombieType);
    }
Beispiel #27
0
    //创建僵尸
    void CreateOneZombie(ZombieType type)
    {
        GameObject zombie = null;

        switch (type)
        {
        case ZombieType.Zombie1:
            zombie = Instantiate(zombie1);
            break;

        default:
            break;
        }
        int row = Random.Range(0, StageMap.MaxRow);

        zombie.transform.position = StageMap.ZombiePosByRow(row);
        zombie.GetComponent <ZombieMove>().Row = row;
        zombie.GetComponent <ZombieSpriteDisplay>().SetOrderByRow(row);
        _model.zombieList[row].Add(zombie);
    }
Beispiel #28
0
 protected override void Cleanup()
 {
     this.Type = (ZombieType)(-1);
     this.Size = 0;
     this.KillReason = null;
 }
        public Zombie(int health, int maxHealth, ZombieType type, ref Model modelwalk, ref Model modelatt, ref Model modelhurt, ref Model modeldie, Action<Entity, Entity> attackFunction, Func<Vector3, Vector3, PathFinding.Node> astarGetter)
            : base()
        {
            this.astarGetter = astarGetter;
            this.model = modelwalk;
            this.HealthPoints = health;
            this.MaxHealth = maxHealth;

            this.MaxVelocity = 0.04f;
            this.MaxAcceleration = 0.04f;
            if (type == ZombieType.Boss)
            {
                this.MaxVelocity *= 2;
                this.MaxAcceleration *= 2;
                this.modelRadius *= 2;
            }
            ArriveRadius = 1;
            FleeRadius = 30;
            TimeToTarget = 0.070f;
            RotationTimeToTarget = 0.00025f;
            InterpolationSpeed = 10;
            TargetRotation = 0.02f;
            SlowRotationThreshold = (float)Math.PI;
            SlowRadiusThreshold = (float)Math.PI * 3;
            MaxRotationSpeed = (float)Math.PI / 12;
            MaxRotationAcceleration = (float)Math.PI;

            PosState = EntityPositionState.SteeringWander;
            OrState = EntityOrientationState.Face;
            BehaviouralState = BehaviourState.Wander;

            zombieType = type;
            MeleeAttack = new Weapon(WeaponType.ZombieHands);
            RangedAttack = new Weapon(WeaponType.Vomit);
            if (type == ZombieType.Boss)
            {
                MeleeAttack.FirePower *= 2;
                RangedAttack.FirePower *= 2;
            }
            this.AttackFunction = attackFunction;
            lastAttackTime = 0;

            // Look up our custom skinning information. for walking
            skinningDatawalk = (SkinningData)modelwalk.Tag;

            if (skinningDatawalk == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerwalk = new AnimationPlayer(skinningDatawalk);
            clipwalk = skinningDatawalk.AnimationClips["Take 001"];
            animationPlayerwalk.StartClip(clipwalk);

            // Look up our custom skinning information. for dying
            skinningDatadie = (SkinningData)modeldie.Tag;

            if (skinningDatadie == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerdie = new AnimationPlayer(skinningDatadie);
            clipdie = skinningDatadie.AnimationClips["Take 001"];
            animationPlayerdie.StartClip(clipdie);

            // Look up our custom skinning information. for attacking
            skinningDataattack = (SkinningData)modelatt.Tag;

            if (skinningDataattack == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerattack = new AnimationPlayer(skinningDataattack);
            clipattack = skinningDataattack.AnimationClips["Take 001"];
            animationPlayerattack.StartClip(clipattack);

            // Look up our custom skinning information. for hurting
            skinningDatahurt = (SkinningData)modelhurt.Tag;

            if (skinningDatahurt == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayerhurt = new AnimationPlayer(skinningDatahurt);
            cliphurt = skinningDatahurt.AnimationClips["Take 001"];
            animationPlayerhurt.StartClip(cliphurt);
        }
Beispiel #30
0
    public void Setup(float zombiespeed, float zombieLife, int priority)
    {

        Alive = true;

        Sync = true;
        ResetSpawn();
        SetLayer(gameObject);
        _TimerA.AddMethod(UnityEngine.Random.Range(0, 1000), PlayRandom);
        zombieType = (ZombieType)priority;
        SetAliveModel(zombieType, true);
        
        speed = zombiespeed;
        MaxLife = Life = zombieLife;        
        transform.localScale = Vector3.one * Math.Min(Mathf.Max(Mathf.Sqrt(zombieLife) / 10, 1f), 3);
        slowdowntime = .2f / transform.localScale.x;
    }
Beispiel #31
0
 public void Initialize(ZombieType type, float size)
 {
     this.Type = type;
     this.Size = size;
     this.KillReason = null;
 }
Beispiel #32
0
        private void SpawnZombies(int number, int spawnPoint)
        {
            #region Spawnpoint
            int minX = 0;
            int maxX = 0;
            int minY = 0;
            int maxY = 0;

            switch (spawnPoint)
            {
            case 0:
                minX = -200;
                maxX = 400;
                minY = -200;
                maxY = -regZombieTexture.Height / 2;
                break;

            case 1:
                minX = 400;
                maxX = 600;
                minY = -200;
                maxY = -regZombieTexture.Height / 2;
                break;

            case 2:
                minX = 600;
                maxX = 1000;
                minY = -200;
                maxY = -regZombieTexture.Height / 2;
                break;

            case 3:
                minX = 800 + regZombieTexture.Width / 2;
                maxX = 1000;
                minY = 0;
                maxY = 800;
                break;

            case 4:
                minX = 600;
                maxX = 1000;
                minY = 600 + regZombieTexture.Height / 2;
                maxY = 800;
                break;

            case 5:
                minX = 400;
                maxX = 600;
                minY = 600 + regZombieTexture.Height / 2;
                maxY = 800;
                break;

            case 6:
                minX = -200;
                maxX = 400;
                minY = 600 + regZombieTexture.Height / 2;
                maxY = 800;
                break;

            case 7:
                minX = -200;
                maxX = -regZombieTexture.Width / 2;
                minY = 0;
                maxY = 800;
                break;
            }
            #endregion

            for (int i = 0; i < number; i++)
            {
                #region ZombieTypeGeneration
                Texture2D  zombieTexture = regZombieTexture;
                ZombieType type          = ZombieType.Regular;
                switch (rand.Next(3))
                {
                case 0:
                    type          = ZombieType.Regular;
                    zombieTexture = regZombieTexture;
                    break;

                case 1:
                    type          = ZombieType.Scout;
                    zombieTexture = scoutZombieTexture;
                    break;

                case 2:
                    type          = ZombieType.Tank;
                    zombieTexture = tankZombieTexture;
                    break;
                }
                #endregion
                int     x        = rand.Next(minX, maxX);
                int     y        = rand.Next(minY, maxY);
                Vector2 position = new Vector2(x, y);
                Zombie  zombie   = new Zombie(zombieTexture, position, type, ObjectTypes.Zombie);
                Game1.AddGameObject(zombie);
            }
        }
Beispiel #33
0
        public Zombie(int health, int maxHealth, ZombieType type, ref Model modelwalk, ref Model modelatt, ref Model modelhurt, ref Model modeldie, Action <Entity, Entity> attackFunction, Func <Vector3, Vector3, PathFinding.Node> astarGetter)
            : base()
        {
            this.astarGetter  = astarGetter;
            this.model        = modelwalk;
            this.HealthPoints = health;
            this.MaxHealth    = maxHealth;

            this.MaxVelocity     = 0.04f;
            this.MaxAcceleration = 0.04f;
            if (type == ZombieType.Boss)
            {
                this.MaxVelocity     *= 2;
                this.MaxAcceleration *= 2;
                this.modelRadius     *= 2;
            }
            ArriveRadius            = 1;
            FleeRadius              = 30;
            TimeToTarget            = 0.070f;
            RotationTimeToTarget    = 0.00025f;
            InterpolationSpeed      = 10;
            TargetRotation          = 0.02f;
            SlowRotationThreshold   = (float)Math.PI;
            SlowRadiusThreshold     = (float)Math.PI * 3;
            MaxRotationSpeed        = (float)Math.PI / 12;
            MaxRotationAcceleration = (float)Math.PI;

            PosState         = EntityPositionState.SteeringWander;
            OrState          = EntityOrientationState.Face;
            BehaviouralState = BehaviourState.Wander;

            zombieType   = type;
            MeleeAttack  = new Weapon(WeaponType.ZombieHands);
            RangedAttack = new Weapon(WeaponType.Vomit);
            if (type == ZombieType.Boss)
            {
                MeleeAttack.FirePower  *= 2;
                RangedAttack.FirePower *= 2;
            }
            this.AttackFunction = attackFunction;
            lastAttackTime      = 0;

            // Look up our custom skinning information. for walking
            skinningDatawalk = (SkinningData)modelwalk.Tag;

            if (skinningDatawalk == null)
            {
                throw new InvalidOperationException
                          ("This model does not contain a SkinningData tag.");
            }

            // Create an animation player, and start decoding an animation clip.
            animationPlayerwalk = new AnimationPlayer(skinningDatawalk);
            clipwalk            = skinningDatawalk.AnimationClips["Take 001"];
            animationPlayerwalk.StartClip(clipwalk);


            // Look up our custom skinning information. for dying
            skinningDatadie = (SkinningData)modeldie.Tag;

            if (skinningDatadie == null)
            {
                throw new InvalidOperationException
                          ("This model does not contain a SkinningData tag.");
            }

            // Create an animation player, and start decoding an animation clip.
            animationPlayerdie = new AnimationPlayer(skinningDatadie);
            clipdie            = skinningDatadie.AnimationClips["Take 001"];
            animationPlayerdie.StartClip(clipdie);


            // Look up our custom skinning information. for attacking
            skinningDataattack = (SkinningData)modelatt.Tag;

            if (skinningDataattack == null)
            {
                throw new InvalidOperationException
                          ("This model does not contain a SkinningData tag.");
            }

            // Create an animation player, and start decoding an animation clip.
            animationPlayerattack = new AnimationPlayer(skinningDataattack);
            clipattack            = skinningDataattack.AnimationClips["Take 001"];
            animationPlayerattack.StartClip(clipattack);

            // Look up our custom skinning information. for hurting
            skinningDatahurt = (SkinningData)modelhurt.Tag;

            if (skinningDatahurt == null)
            {
                throw new InvalidOperationException
                          ("This model does not contain a SkinningData tag.");
            }

            // Create an animation player, and start decoding an animation clip.
            animationPlayerhurt = new AnimationPlayer(skinningDatahurt);
            cliphurt            = skinningDatahurt.AnimationClips["Take 001"];
            animationPlayerhurt.StartClip(cliphurt);
        }
Beispiel #34
0
 public Zombie(int id, ZombieTrait zombieTrait, ZombieType zombieType)
 {
     this.Trait = zombieTrait;
     this.Type  = zombieType;
     this.Id    = id;
 }
Beispiel #35
0
 public Zombie(Texture2D texture, Vector2 position, ZombieType zombieType, ObjectTypes type) : base(texture, position, BaseSpeed, type)
 {
     player          = Game1.GetPlayer();
     this.zombieType = zombieType;
     AddTypeBonuses();
 }
 private static bool CanAttack(ZombieType zombieType)
 {
     return zombieType != ZombieType.GoldenGoblin;
 }
Beispiel #37
0
    private List <Zombie> FillZombieList(WaveType waveType, int mainZombieCount, int extraZombieCount, CustomWaveSettings customSettings)
    {
        List <Zombie> result = new List <Zombie>();

        if (waveType == WaveType.TestBoss)
        {
            Zombie zombie = _zombiePool.GetZombieModel(_testBossType, _hpPerZombie, true);
            result.Add(zombie);
            return(result);
        }

        if (waveType == WaveType.Test)
        {
            int typesCount         = (System.Enum.GetValues(typeof(ZombieType)).Length - 1);
            int zombiePerTypeCount = _currentZombieCount / typesCount;
            for (int i = 1; i <= typesCount; i++)
            {
                ZombieType zombieType = (ZombieType)(1 << i);

                for (int j = 0; j < zombiePerTypeCount; j++)
                {
                    Zombie zombie = _zombiePool.GetZombieModel(zombieType, _hpPerZombie, false);
                    result.Add(zombie);
                }
            }
            return(result);
        }

        ZombieType mainZombieType = _currentMainZombieType;

        int waveNumberWithOffset = WaveNumber + _gameConfig.waveSettings.extraWaveFirstOffset;

        if (waveNumberWithOffset % _gameConfig.waveSettings.extraWavePeriod == 0)
        {
            if (customSettings != null)
            {
                if (customSettings.waveEvent == ZombieWaveEvent.CustomWave)
                {
                    mainZombieType = customSettings.zombieType;
                }
            }
            else
            {
                int index = UnityEngine.Random.Range(0, _otherAddTypes.Count);
                mainZombieType = _otherAddTypes[index];
            }

            for (int i = 0; i < mainZombieCount; i++)
            {
                result.Add(_zombiePool.GetZombieModel(mainZombieType, _hpPerZombie, false));
            }
        }
        else
        {
            for (int i = 0; i < mainZombieCount; i++)
            {
                result.Add(_zombiePool.GetZombieModel(_currentMainZombieType, _hpPerZombie, waveType == WaveType.Boss));
            }

            for (int i = 0; i < extraZombieCount; i++)
            {
                int        index      = UnityEngine.Random.Range(0, _otherAddTypes.Count);
                ZombieType zombieType = _otherAddTypes[index];
                result.Add(_zombiePool.GetZombieModel(zombieType, _hpPerZombie, false));
            }
        }

        return(result);
    }
Beispiel #38
0
 public Material getColor(ZombieType t)
 {
     return(ZombieColor[(int)t]);
 }
Beispiel #39
0
 //evolve to the next zombie
 public void evolve()
 {
     if(zombieType != freak)
         zombieType += 1;
     updateZombieAttribute();
 }
Beispiel #40
0
 private void SetAliveModel(ZombieType zt, bool alive)
 {
     bool big = zt == ZombieType.Life;
     bool fast = zt == ZombieType.Speed;
     bool norm = zt == ZombieType.Normal;
     foreach (var a in DeadZombie.GetComponentsInChildren<Renderer>())
         a.enabled = norm && !alive;
     foreach (var a in AliveZombie.GetComponentsInChildren<Renderer>())
         a.enabled = norm && alive;
     foreach (var a in BigZombie.GetComponentsInChildren<Renderer>())
         a.enabled = big && alive;
     foreach (var a in BigDeadZombie.GetComponentsInChildren<Renderer>())
         a.enabled = big && !alive;
     foreach (var a in FastZombie.GetComponentsInChildren<Renderer>())
         a.enabled = fast && alive;
     foreach (var a in FastDeadZombie.GetComponentsInChildren<Renderer>())
         a.enabled = fast && !alive;
 }
Beispiel #41
0
 public static void SpawnZombieDeathParticles(Vector3 _pos, ZombieType _typ)
 {
     singleton.particleSystems[(int)_typ].SpawnParticles(_pos);
 }
Beispiel #42
0
 public ZombieParameter(ZombieType type, ZombieTrait trait, int count)
 {
     Type  = type;
     Trait = trait;
     Count = count;
 }
 void CreateOneZombie(ZombieType type)
 {
     GameObject zombie;
     switch (type) {
         case ZombieType.Zombie1:
             zombie = Instantiate(Zombie1);
             break;
         case ZombieType.Zombie2:
             zombie = Instantiate(Zombie2);
             break;
         case ZombieType.FlagZombie:
             zombie = Instantiate(FlagZombie);
             break;
         case ZombieType.ConeheadZombie:
             zombie = Instantiate(ConeheadZombie);
             break;
         case ZombieType.BucketheadZombie:
             zombie = Instantiate(BucketheadZombie);
             break;
         case ZombieType.PoleVaultingZombie:
             zombie = Instantiate(PoleVaultingZombie);
             break;
         case ZombieType.NewspaperZombie:
             zombie = Instantiate(NewspaperZombie);
             break;
         default:
             throw new System.Exception("Wrong zombie type");
     }
     int row = Random.Range(0, StageMap.ROW_MAX - 1);
     zombie.transform.position = StageMap.GetZombiePos(row);
     zombie.GetComponent<ZombieMove>().row = row;
     zombie.GetComponent<SpriteDisplay>().SetOrderByRow(row);
     model.zombieList[row].Add(zombie);
 }