Beispiel #1
0
        public void WriteFieldData(ulong fieldId, HeroTypes type, int variableId)
        {
            switch (Stream.Style)
            {
            case 7:
                throw new InvalidDataException("Unable to get field id");

            case 8:
                throw new InvalidDataException("Unable to get field id");

            case 9:
            case 10:
                throw new InvalidDataException("Unable to get field id");

            default:
                Stream.Write((long)fieldId - (long)m_28);
                m_28 = fieldId;
                if (Stream.Flags[0])
                {
                    Stream.Write((ulong)type);
                }
                WriteVariableId(variableId);
                break;
            }
        }
Beispiel #2
0
        protected HeroType(OmegaStream stream)
        {
            this.Type = (HeroTypes)stream.ReadByte();
            switch (this.Type)
            {
            case HeroTypes.Enum:
            case HeroTypes.Class:
            case HeroTypes.NodeRef:
                this.Id = new DefinitionId(stream.ReadULong());
                return;

            case HeroTypes.String:
                break;

            case HeroTypes.List:
                this.Values = new HeroType(stream);
                return;

            case HeroTypes.LookupList:
                this.Indexer = new HeroType(stream);
                this.Values  = new HeroType(stream);
                break;

            default:
                return;
            }
        }
Beispiel #3
0
 public void SetValueType(HeroTypes type)
 {
     if (base.Stream.Flags[0])
     {
         base.Stream.Write((ulong)((long)type));
     }
 }
Beispiel #4
0
        public static Object DeserializeType(EndianBinaryReader reader, HeroTypes type, Byte format)
        {
            switch (type)
            {
            case HeroTypes.Integer:
                return(DeserializeInteger(reader, format));

            case HeroTypes.Id:
                return(DeserializeInteger(reader, format));

            case HeroTypes.Boolean:
                return(DeserializeBoolean(reader, format));

            case HeroTypes.Float:
                return(DeserializeSingle(reader, format));

            case HeroTypes.Enum:
                return(DeserializeInteger(reader, format));

            case HeroTypes.List:
                return(DeserializeList(reader, format));

            case HeroTypes.Vector3:
                return(DeserializeVector3(reader, format));

            default:
                return(null);
            }
        }
Beispiel #5
0
 public DeserializeList(PackedStream_2 stream, int valueState) : base(stream, HeroTypes.List)
 {
     this.index = 0;
     this.m_30  = false;
     if (stream.Flags[4])
     {
         if (base.Next == null)
         {
             throw new InvalidDataException("Only a HeroClass can be the root container type");
         }
         throw new NotImplementedException();
     }
     if (valueState != 1)
     {
         throw new InvalidDataException("Invalid value state");
     }
     if (stream.Flags[0])
     {
         ulong num;
         stream.Read(out num);
         this.listType = (HeroTypes)((int)num);
     }
     stream.Read(out this.m_0C, out this.Count);
     if ((stream.Style == 8) || (stream.Style == 10))
     {
         this.m_30  = (base.Count & 1) == 1;
         base.Count = base.Count >> 1;
     }
 }
 public void SetValueType(HeroTypes type)
 {
     if (!this.Stream.Flags[0])
     {
         return;
     }
     this.Stream.Write((ulong)type);
 }
Beispiel #7
0
 public Hero(Hero hero)
 {
     this.HeroType           = hero.HeroType;
     this.Name               = hero.Name;
     this.HitPoints          = hero.HitPoints;
     this.AttackDamage       = hero.AttackDamage;
     this.TimeBetweenAttacks = hero.TimeBetweenAttacks;
     this.Attacks            = hero.Attacks;
 }
Beispiel #8
0
 public void Upgrade(HeroTypes tp)
 {
     if (gm.gold >= _upgrades[tp] && _maxHeroes[tp] < 16)
     {
         gm.gold        -= _upgrades[tp];
         _maxHeroes[tp] += 1;
         _upgrades[tp]   = System.Convert.ToInt32(100 * (System.Math.Pow(1.15f, _maxHeroes[tp])));
     }
 }
 public SerializeStateBase(PackedStream2 stream, HeroTypes heroType)
 {
     HeroType     = heroType;
     Next         = null;
     Stream       = stream;
     m_0C         = 0U;
     Count        = 0U;
     Next         = stream.State;
     stream.State = this;
 }
 public SerializeStateBase(PackedStream_2 stream, HeroTypes heroType)
 {
     this.HeroType = heroType;
     this.Next     = (SerializeStateBase)null;
     this.Stream   = stream;
     this.m_0C     = 0U;
     this.Count    = 0U;
     this.Next     = stream.State;
     stream.State  = this;
 }
Beispiel #11
0
    void Start()
    {
        //Init Anim
        animtr   = GetComponent <Animator>();
        statusID = Animator.StringToHash("AnimStatus");
        status   = Status.Idle;

        //Init OtherData
        offset = new Vector2(1.4f, -0.8f);
        Radius = 10f;
        type   = HeroTypes.Archer;
    }
Beispiel #12
0
        public Hero getHero(HeroTypes heroType)
        {
            switch (heroType)
            {
            case HeroTypes.Ironman: return(new IronMan());

            case HeroTypes.Hulk: return(new Hulk());

            case HeroTypes.Spiderman: return(new Spiderman());

            default: return(new CustomHero());
            }
        }
Beispiel #13
0
    public Hero GenerateArcher()
    {
        _minHPRange = 8;
        _maxHPRange = 20;

        this.HeroType           = HeroTypes.archer;
        this.Name               = HeroType.ToString();
        this.HitPoints          = Random.Range(8, 20);
        this.AttackDamage       = Random.Range(6, 15);
        this.TimeBetweenAttacks = 20f;

        SetHP();

        return(this);
    }
Beispiel #14
0
    public Hero GenerateWizard()
    {
        _minHPRange = 4;
        _maxHPRange = 8;

        this.HeroType           = HeroTypes.wizard;
        this.Name               = HeroType.ToString();
        this.HitPoints          = Random.Range(4, 8);
        this.AttackDamage       = Random.Range(10, 25);
        this.TimeBetweenAttacks = 30f;

        SetHP();

        return(this);
    }
Beispiel #15
0
        public override void Deserialize(PackedStream_2 stream)
        {
            base.hasValue  = true;
            this.Variables = new VariableList();
            DeserializeClass class2 = new DeserializeClass(stream, 1);

            for (uint i = 0; i < class2.Count; i++)
            {
                ulong        num2;
                int          num5;
                HeroFieldDef definition;
                HeroAnyValue value2;
                uint         num3       = 0;
                int          variableId = 0;
                class2.ReadFieldData(out num2, ref num3, ref variableId, out num5);
                if (num5 == 2)
                {
                    continue;
                }
                HeroType     type  = new HeroType((HeroTypes)num3);
                DefinitionId field = new DefinitionId(num2);
                if (field.Definition != null)
                {
                    definition = field.Definition as HeroFieldDef;
                    HeroTypes types = definition.FieldType.Type;
                    if (types != HeroTypes.Enum)
                    {
                        if (types == HeroTypes.LookupList)
                        {
                            goto Label_0096;
                        }
                        if (types != HeroTypes.ScriptRef)
                        {
                            goto Label_009F;
                        }
                    }
                    type.Id = definition.FieldType.Id;
                }
                goto Label_009F;
Label_0096:
                type = definition.FieldType;
Label_009F:
                value2 = HeroAnyValue.Create(type);
                value2.Deserialize(stream);
                this.Variables.Add(new Variable(field, variableId, value2));
            }
        }
Beispiel #16
0
 public void RemoveHero(HeroTypes tp, bool bonus)
 {
     Debug.Log("hero dead");
     _heroes[tp] -= 1;
     if (_heroes[tp] < 0)
     {
         _heroes[tp] = 0;
     }
     if (bonus)
     {
         gm.PlayAudio(bonusSound);
     }
     else
     {
         gm.PlayAudio(deadClip);
     }
 }
Beispiel #17
0
        public void SendCreateCharacter(
            string characterName,
            RaceTypes race,
            HeroTypes hero,
            ClassTypes characterClass,
            StartBonusTypes bonus)
        {
            var d = new Dictionary <byte, object>
            {
                { (byte)GameParameters.ControlCode, GameOpCode.CreateCharacter },
                { (byte)GameParameters.Name, characterName },
                { (byte)GameParameters.Race, (int)race },
                { (byte)GameParameters.Hero, (int)hero },
                { (byte)GameParameters.StartBonus, (int)bonus },
                { (byte)GameParameters.CharacterClass, (int)characterClass }
            };

            peer.OpCustom((byte)GameOpCode.CustomOp, d, true);
        }
Beispiel #18
0
        protected HeroType(OmegaStream stream)
        {
            Type = (HeroTypes)stream.ReadByte();
            switch (Type)
            {
            case HeroTypes.Enum:
            case HeroTypes.Class:
            case HeroTypes.NodeRef:
                Id = new DefinitionId(stream.ReadULong());
                break;

            case HeroTypes.List:
                Values = new HeroType(stream);
                break;

            case HeroTypes.LookupList:
                Indexer = new HeroType(stream);
                Values  = new HeroType(stream);
                break;
            }
        }
Beispiel #19
0
 public SerializeList(PackedStream_2 stream, int valueState, HeroTypes listType, int Count) : base(stream, HeroTypes.List)
 {
     this.index = 0;
     if (stream.Flags[4])
     {
         throw new NotImplementedException();
     }
     if (stream.Flags[0])
     {
         ulong num = (ulong)((long)listType);
         stream.Write(num);
     }
     if ((stream.Style == 8) || (stream.Style == 10))
     {
         stream.Write(Count * 2, Count * 2);
     }
     else
     {
         stream.Write(Count, Count);
     }
 }
Beispiel #20
0
 public DeserializeList(PackedStream_2 stream, int valueState)
     : base(stream, HeroTypes.List)
 {
     this.index = 0U;
     this.m_30  = false;
     if (stream.Flags[4])
     {
         if (this.Next == null)
         {
             throw new InvalidDataException("Only a HeroClass can be the root container type");
         }
         else
         {
             throw new NotImplementedException();
         }
     }
     else
     {
         if (valueState != 1)
         {
             throw new InvalidDataException("Invalid value state");
         }
         if (stream.Flags[0])
         {
             ulong num;
             stream.Read(out num);
             this.listType = (HeroTypes)num;
         }
         stream.Read(out this.m_0C, out this.Count);
         if (stream.Style != 8 && stream.Style != 10)
         {
             return;
         }
         this.m_30 = ((int)this.Count & 1) == 1;
         DeserializeList deserializeList = this;
         int             num1            = (int)(deserializeList.Count >> 1);
         deserializeList.Count = (uint)num1;
     }
 }
Beispiel #21
0
 public bool AddSprout(HeroTypes tp)
 {
     Debug.Log("hero creation request" + tp);
     if (gm.isGameOver())
     {
         return(false);
     }
     if (_heroes[tp] < _maxHeroes[tp])
     {
         for (uint i = 0; i < 16; ++i)
         {
             if (_sproutsTypes[i] == HeroTypes.NULL)
             {
                 _heroes[tp]      += 1;
                 _images[i].sprite = _colors[tp];
                 _images[i].color  = new Color(1, 1, 1, 0.1f);
                 _sproutsTypes[i]  = tp;
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #22
0
    public Hero GenerateKnight()
    {
        _minHPRange = 10;
        _maxHPRange = 25;

        this.HeroType           = HeroTypes.knight;
        this.Name               = HeroType.ToString();
        this.AttackDamage       = Random.Range(6, 18);
        this.TimeBetweenAttacks = 3f;

        this.Attacks = new Attack[] {
            new Attack("Low Swipe", 0, 0, "Attack"),
            new Attack("Quick Attack", 1, 0, "Attack2"),
            new Attack("Spin Attack", 2, 1, "Attack3"),
            new Attack("Power Spin", 5, 2, "Attack4"),
            new Attack("Battle Cry", 2, 1, "BattleCry", true)
        };


        SetHP();

        return(this);
    }
Beispiel #23
0
        public DeserializeList(PackedStream2 stream, int valueState)
            : base(stream, HeroTypes.List)
        {
            Index = 0U;
            M30   = false;
            if (stream.Flags[4])
            {
                if (Next == null)
                {
                    throw new InvalidDataException("Only a HeroClass can be the root container type");
                }
            }
            else
            {
                if (valueState != 1)
                {
                    throw new InvalidDataException("Invalid value state");
                }

                if (stream.Flags[0])
                {
                    UInt64 num;
                    stream.Read(out num);
                    ListType = (HeroTypes)num;
                }
            }

            stream.Read(out m_0C, out Count);
            if (stream.Style != 8 && stream.Style != 10)
            {
                return;
            }

            M30     = (Count & 1) == 1;
            Count >>= 1;
        }
        public void WriteFieldData(ulong fieldId, HeroTypes type, int variableId)
        {
            switch (base.Stream.Style)
            {
            case 7:
                throw new InvalidDataException("Unable to get field id");

            case 8:
                throw new InvalidDataException("Unable to get field id");

            case 9:
            case 10:
                throw new InvalidDataException("Unable to get field id");
            }
            long num = (long)(fieldId - this.m_28);

            base.Stream.Write(num);
            this.m_28 = fieldId;
            if (base.Stream.Flags[0])
            {
                base.Stream.Write((ulong)((long)type));
            }
            base.WriteVariableId(variableId);
        }
Beispiel #25
0
 public void SetValuesType(HeroTypes type)
 {
     this.Values = new HeroType(type);
 }
Beispiel #26
0
 public HeroType(HeroTypes type)
 {
     this.Type = type;
 }
Beispiel #27
0
 public HeroType()
 {
     this.Type = HeroTypes.None;
 }
Beispiel #28
0
 public HeroType()
 {
     Type = HeroTypes.None;
 }
Beispiel #29
0
 public HeroType(HeroTypes type)
 {
     Type = type;
 }