Esempio n. 1
0
        public bool CheckTargetPriority(ProjetPirate.Boat.BoatCharacter pCharacter)
        {
            bool isTakingPriority = true;

            for (int i = 0; i < _targettingPriority.Count; i++)
            {
                switch (_targettingPriority[i])
                {
                case AggroRequiredType.XP_More:
                    if (pCharacter.getCurrentXp() < _target.GetComponent <Boat.BoatCharacter>().getCurrentXp())
                    {
                        isTakingPriority = false;
                    }
                    break;

                case AggroRequiredType.XP_Less:
                    if (pCharacter.getCurrentXp() > _target.GetComponent <Boat.BoatCharacter>().getCurrentXp())
                    {
                        isTakingPriority = false;
                    }
                    break;

                case AggroRequiredType.BoatLevel_More:
                    if ((int)pCharacter.ShipType < (int)_target.GetComponent <Boat.BoatCharacter>().ShipType)
                    {
                        isTakingPriority = false;
                    }
                    break;

                case AggroRequiredType.BoatLevel_Less:
                    if ((int)pCharacter.ShipType > (int)_target.GetComponent <Boat.BoatCharacter>().ShipType)
                    {
                        isTakingPriority = false;
                    }
                    break;

                case AggroRequiredType.None:
                    break;

                case AggroRequiredType.Life_More:
                    if (pCharacter.getCurrentLife() < _target.GetComponent <Boat.BoatCharacter>().getCurrentLife())
                    {
                        isTakingPriority = false;
                    }
                    break;

                case AggroRequiredType.Life_Less:
                    if (pCharacter.getCurrentLife() > _target.GetComponent <Boat.BoatCharacter>().getCurrentLife())
                    {
                        isTakingPriority = false;
                    }
                    break;

                default:
                    break;
                }
            }
            return(isTakingPriority);
        }
Esempio n. 2
0
        public bool CheckRangeCategoryOnAttack(ProjetPirate.Boat.BoatCharacter pPotentialTarget)
        {
            float distance = Vector3.Distance(this.transform.position, pPotentialTarget.transform.position);

            for (int i = 0; i < _onAttackRangeCategories.Count; i++)
            {
                if (_onAttackRangeCategories[i].RangeRatio * _defaultRange >= distance | _onAttackRangeCategories[i].RangeRatio == 0)
                {
                    switch (_onAttackRangeCategories[i].Type)
                    {
                    case AggroRequiredType.XP_More:
                        switch (pPotentialTarget.ShipType)
                        {
                        case Boat.ShipType.Player_Level_1:
                        case Boat.ShipType.Player_Level_2:
                        case Boat.ShipType.Player_Level_3:
                            if (pPotentialTarget.Controller.GetComponent <Player>()._data.Ressource.Reputation >= _onAttackRangeCategories[i].Quantity)
                            {
                                _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        default:
                            break;
                        }
                        break;

                    case AggroRequiredType.XP_Less:
                        switch (pPotentialTarget.ShipType)
                        {
                        case Boat.ShipType.Player_Level_1:
                        case Boat.ShipType.Player_Level_2:
                        case Boat.ShipType.Player_Level_3:
                            if (pPotentialTarget.Controller.GetComponent <Player>()._data.Ressource.Reputation <= _onDetectionRangeCategories[i].Quantity)
                            {
                                Debug.Log(i);
                                _behaviour = _onDetectionRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        default:
                            break;
                        }
                        break;

                    case AggroRequiredType.BoatLevel_Less:
                        switch (pPotentialTarget.ShipType)
                        {
                        case Boat.ShipType.Player_Level_1:
                            if (_onAttackRangeCategories[i].Quantity <= 1)
                            {
                                _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        case Boat.ShipType.Player_Level_2:
                            if (_onAttackRangeCategories[i].Quantity <= 2)
                            {
                                _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        case Boat.ShipType.Player_Level_3:
                            if (_onAttackRangeCategories[i].Quantity <= 3)
                            {
                                _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        default:
                            break;
                        }
                        break;

                    case AggroRequiredType.BoatLevel_More:
                        switch (pPotentialTarget.ShipType)
                        {
                        case Boat.ShipType.Player_Level_1:
                            if (_onAttackRangeCategories[i].Quantity >= 1)
                            {
                                _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        case Boat.ShipType.Player_Level_2:
                            if (_onAttackRangeCategories[i].Quantity >= 2)
                            {
                                _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        case Boat.ShipType.Player_Level_3:
                            if (_onAttackRangeCategories[i].Quantity >= 3)
                            {
                                _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                                return(true);
                            }
                            break;

                        default:
                            break;
                        }
                        break;

                    case AggroRequiredType.None:
                        _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                        return(true);

                    case AggroRequiredType.Life_More:
                        if (pPotentialTarget.getCurrentLife() > _onAttackRangeCategories[i].Quantity)
                        {
                            _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                        }
                        break;

                    case AggroRequiredType.Life_Less:
                        if (pPotentialTarget.getCurrentLife() < _onAttackRangeCategories[i].Quantity)
                        {
                            _behaviour = _onAttackRangeCategories[i].AssociatedBehaviour;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            return(false);
        }