コード例 #1
0
ファイル: WeaponItem.cs プロジェクト: penspanic/ZombieTrain
        public override void Use(Character owner)
        {
            base.Use(owner);
            GameObject prefab = Resources.Load <GameObject>("Prefabs/Item/Weapons/" + WeaponId);

            if (prefab == null)
            {
                throw new UnityException(WeaponId + " Weapon prefab not found!");
            }
            WeaponBase weapon = Instantiate(prefab).GetComponent <WeaponBase>();

            Sdb.WeaponInfo weaponInfo = SdbInstance <Sdb.WeaponInfo> .Get(WeaponId);

            if (WeaponId != "Basic_Weapon")
            {
                switch (weaponInfo.Grade)
                {
                case Constants.WeaponGrade.Low:
                    EffectManager.Instance.Show(EffectType.Item_Low, this.gameObject.transform.position);
                    break;

                case Constants.WeaponGrade.Normal:
                    EffectManager.Instance.Show(EffectType.Item_Normal, this.gameObject.transform.position);
                    break;

                case Constants.WeaponGrade.High:
                    EffectManager.Instance.Show(EffectType.Item_High, this.gameObject.transform.position);
                    break;
                }
            }
            weapon.Init(weaponInfo);
            weapon.SetOwner(owner);
            ActorContainer.Instance.LocalCharacter.EquipWeapon(weapon);
        }
コード例 #2
0
        private void PlayAttackAnimation()
        {
            switch (_owner.Weapon.WeaponInfo.Type)
            {
            case Constants.WeaponType.Melee:
                _owner.Animator.SetTrigger("Meele");
                break;

            case Constants.WeaponType.RangeWeapon:
                Sdb.LauncherInfo launcherInfo = SdbInstance <Sdb.LauncherInfo> .Get(_owner.Weapon.WeaponInfo.Id);

                if (launcherInfo.Type == Constants.LaunchType.Parabolic)
                {
                    _owner.Animator.SetTrigger("Throw");
                }
                else
                {
                    _owner.Animator.SetTrigger("Launcher");
                }

                break;

            default:
                break;
            }
        }
コード例 #3
0
ファイル: HotelManager.cs プロジェクト: penspanic/DDPGamejam
        public void CheckOut(Visitor visitor, int visitorScore)
        {
            var visitorInfo = SdbInstance <Sdb.VisitorInfo> .Get(visitor.Info.RaceType.ToString());

            var gradeInfo = SpecificSdb <Sdb.HotelGradeInfo> .Get();

            int originalGrade = gradeInfo.GetGrade(Score);
            int originalScore = Score;

            Score += visitorScore * visitorInfo.VipGrade;
            int newGrade = gradeInfo.GetGrade(Score);

            if (originalGrade != newGrade)
            {
                if (originalGrade > newGrade)
                {
                    Score = gradeInfo.Grades[originalGrade - 1].X;
                }
                else
                {
                    OnGradeChanged?.Invoke(newGrade, originalGrade);
                }
            }
            if (newGrade > originalGrade)
            {
                Debug.Log("UpGrade!!, new: " + newGrade + ", ori: " + originalGrade + " new score : " + Score + " ori score : " + originalScore);
                Main_Scene.GradeChangeListener.Instance.OnHotelGradeIncreased();
            }

            OnExpRateChanged?.Invoke(gradeInfo.GetExpRate(Score));
        }
コード例 #4
0
        private void CreateCharacter()
        {
            Character character = ActorFactory.Instance.Create(SdbInstance <Sdb.ActorInfo> .Get("Character1")) as Character;

            character.transform.position = new Vector3(-5f, -1.37f, 0f);
            character.EquipWeapon(null);
            //SectorManager.Instance.CreateRandomBox(character.transform.position.x + 1f, "Basic_Weapon");
            InputManager.Instance.SetCharacter(character);
            CameraManager.Instance.SetCharacter(character);
        }
コード例 #5
0
        private void LoadStage()
        {
            Application.targetFrameRate = 60;
            CreateCharacter();

            _currentStageInfo = SdbInstance <Sdb.StageInfo> .Get(DynamicInfo.DynamicInfo.SelectedStageId);

            SectorManager.Instance.CreateSectors();
            SectorManager.Instance.ChangeSector(0);
        }
コード例 #6
0
        private void CreateZombies()
        {
            for (int i = 0; i < CurrentSectorInfo.ZombieCount; ++i)
            {
                Sdb.ActorInfo zombieActorInfo = SdbInstance <Sdb.ActorInfo> .Get("Zombie");

                ActorBase zombieActor = ActorFactory.Instance.Create(zombieActorInfo);
                zombieActor.transform.position = GetZombieCreatePosition();
            }
        }
コード例 #7
0
        public Visitor Create(Constants.RaceType raceType)
        {
            Visitor visitorInstance = Instantiate(visitorPrefab).GetComponent <Visitor>();
            var     visitorInfo     = SdbInstance <Sdb.VisitorInfo> .Get(raceType.ToString());

            if (visitorInfo == null)
            {
                Debug.LogError("VisitorInfo is null, Id : " + raceType.ToString());
            }

            visitorInstance.Info   = visitorInfo;
            visitorInstance.Serial = serialGenerator.Get();

            visitorInstance.ApplySpriteSources(raceType);
            visitorInstance.transform.position = visitorCreateTransform.position;
            return(visitorInstance);
        }
コード例 #8
0
        private int CalculateScore(Logic.Visitor visitor)
        {
            Constants.RaceType raceType    = visitor.Info.RaceType;
            Sdb.VisitorInfo    visitorInfo = SdbInstance <Sdb.VisitorInfo> .Get(raceType.ToString());

            int score = 0;

            int selectedIndex = visitorInfo.Attributes.IndexOf(visitor.SelectedAttribute);

            score += GetElementScore(selectedIndex);

            selectedIndex = visitorInfo.Facilities.IndexOf(visitor.SelectedFacility);
            score        += GetElementScore(selectedIndex);

            selectedIndex = visitorInfo.Foods.IndexOf(visitor.SelectedFood);
            score        += GetElementScore(selectedIndex);

            return(score);
        }
コード例 #9
0
ファイル: ItemFactory.cs プロジェクト: penspanic/ZombieTrain
        private string GetRandomWeaponId()
        {
            // 50, 30, 20
            List <Sdb.WeaponInfo> weaponInfos = SdbInstance <Sdb.WeaponInfo> .GetAll();

            Dictionary <Constants.WeaponGrade, List <Sdb.WeaponInfo> > infoByGrade = new Dictionary <Constants.WeaponGrade, List <Sdb.WeaponInfo> >();

            for (int i = 0; i < weaponInfos.Count; ++i)
            {
                if (infoByGrade.ContainsKey(weaponInfos[i].Grade) == false)
                {
                    infoByGrade.Add(weaponInfos[i].Grade, new List <Sdb.WeaponInfo>());
                }

                infoByGrade[weaponInfos[i].Grade].Add(weaponInfos[i]);
            }

            infoByGrade[Constants.WeaponGrade.Low].Remove(SdbInstance <Sdb.WeaponInfo> .Get("Basic_Weapon"));
            float random = Random.value;

            Constants.WeaponGrade selectedGrade = Constants.WeaponGrade.Undefined;
            if (random > 0.8f)
            {
                selectedGrade = Constants.WeaponGrade.High;
            }
            else if (random > 0.5f)
            {
                selectedGrade = Constants.WeaponGrade.Normal;
            }
            else
            {
                selectedGrade = Constants.WeaponGrade.Low;
            }

            int gradeWeaponsCount = infoByGrade[selectedGrade].Count;

            return(infoByGrade[selectedGrade][Random.Range(0, gradeWeaponsCount)].Id);
        }
コード例 #10
0
 public override void Init(WeaponInfo weaponInfo)
 {
     base.Init(weaponInfo);
     MeleeWeaponInfo = SdbInstance <Sdb.MeleeWeaponInfo> .Get(weaponInfo.Id);
 }
コード例 #11
0
ファイル: Character.cs プロジェクト: penspanic/ZombieTrain
        public override void Init(ActorInfo actorInfo)
        {
            base.Init(actorInfo);

            CharacterInfo = SdbInstance <Sdb.CharacterInfo> .Get(actorInfo.Id);
        }