//最初はヘルパーをスポーンする
 public void Init(B_Player p)
 {
     player = p;
     if (helper == null)
     {
         Vector3       spawnPoint = new Vector3(transform.position.x, transform.position.y, transform.position.z + spawnOffset);
         KitchenHelper newHelper  = Instantiate(HelperPrefab, spawnPoint, transform.rotation) as KitchenHelper;
         helper             = newHelper;
         helper.towerScript = this;
         Transform gameScene = GameObject.FindGameObjectWithTag(StaticStrings.gameScene).transform;
         helper.transform.SetParent(gameScene);
     }
     updateTowerUI();
     b_collider = GetComponent <BoxCollider>();
     if (flag != null)
     {
         flagPos      = flag.transform.localPosition;
         flagStartPos = flagPos;
     }
     if (healthbar == null)
     {
         return;
     }
     healthbar.maxValue = maxHealh;
     Height             = 0;
     fireLifeTime       = 8;
     damageforSecond    = 1;
     damageDelayCounter = 1;
     damageDelay        = 1;
 }
Example #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Helper")
        {
            if (!cantake)
            {
                return;
            }
            KitchenHelper helper = other.GetComponent <KitchenHelper>();
            //段階によって取られます
            if (other.GetComponent <FiniStateMachine>().currentState.stateType != stateType.cake)
            {
                return;
            }

            if (helper.haveMaterial)
            {
                return;
            }
            //flag->true
            helper.reciveMaterial();
            //リストから削除
            PancakeSpawner.instance.RemovePancake(this.transform);
            Destroy(gameObject);
        }
    }
Example #3
0
 public DefenceSM(NavMeshAgent ag, FiniStateMachine st, KitchenHelper hp, STATUS _status, stateType stateTYPE, Animator an) : base(ag, st, hp, _status, stateTYPE, an)
 {
     chasingDistance = status.getCurrentweapon.chasingdistance;
     attackingTime   = status.getCurrentweapon.attackdelay;
     attackRange     = status.getCurrentweapon.attackrange;
     attacktimer     = attackingTime;
 }
Example #4
0
 public AIState(NavMeshAgent ag, FiniStateMachine st, KitchenHelper hp, STATUS _status, stateType stateTYPE, Animator an)
 {
     stateMachine = st;
     agent        = ag;
     helper       = hp;
     status       = _status;
     stateType    = stateTYPE;
     anim         = an;
 }
Example #5
0
        public void GetKitchenHelperWithIngredient(Ingredients randomIngredient)
        {
            KitchenHelper helperWithIngredient = kitchenHelpers
                                                 .FindAll(helper => helper.IngredientStock[randomIngredient] > 0)
                                                 .FirstOrDefault();

            if (helperWithIngredient != null)
            {
                helperWithIngredient.GiveChefTheIngredient(randomIngredient);
            }
            else
            {
                kitchenHelpers.ForEach(helper => Console.WriteLine($"{helper.Name} yells: 'We are all out!'"));
            }
        }
        public void TryToGiveIngredient_WhenHelperHasIngredient_ReturnsTrue()
        {
            bool       validHelper = false;
            Ingredient ingredient  = Ingredient.Carrot;
            bool       result      = false;

            while (!validHelper)
            {
                KitchenHelper helper = new KitchenHelper(null, DateTime.Today, 0);
                if (helper.HasIngredient(ingredient))
                {
                    result      = helper.TryToGiveIngredient(ingredient);
                    validHelper = true;
                }
            }

            Assert.AreEqual(true, result);
        }
Example #7
0
    private void Start()
    {
        playerID        = "P1_";
        Tower.TowerTeam = team;
        Tower.Init(this);
        Helper = Tower.returnHelper();
        Helper.INIT(this, this.team);
        status = new STATUS();
        Gun newGun = new Gun(100, 20, 1.5f, 1, 1, 1);

        status.changeWeapon(newGun);
        status.getCurrentweapon.Attack = 1;
        Invoke("InIt", 2);
        skillparticle = GetComponentInChildren <ParticleSystem>();
        c             = GetComponentInChildren <Camera>();
        spark         = GetComponentInChildren <ParticleSystem>();
        playerMarker  = icon.GetComponent <SpriteRenderer>().sprite;
    }
    void Start()
    {
        rb     = GetComponent <Rigidbody>();
        anim   = GetComponent <Animator>();
        agent  = GetComponent <NavMeshAgent>();
        helper = GetComponent <KitchenHelper>();
        player = helper.getPlayer();
        WeaponModel.SetActive(false);
        EventsInitializing();
        STATUS status = helper.status;

        validStates = new Dictionary <stateType, AIState>();
        validStates.Add(stateType.idle, new IdleSM(this.agent, this, helper, status, stateType.idle, anim));
        validStates.Add(stateType.attack, new AttackSM(this.agent, this, helper, status, stateType.attack, anim));
        validStates.Add(stateType.defence, new DefenceSM(this.agent, this, helper, status, stateType.defence, anim));
        validStates.Add(stateType.cake, new MakeCakeSM(this.agent, this, helper, status, stateType.cake, anim));
        currentState = validStates[stateType.defence];
        pastState    = validStates[stateType.cake];
        changeState(stateType.idle);
        isfrozen = false;
    }
Example #9
0
 public AttackSM(NavMeshAgent ag, FiniStateMachine st, KitchenHelper hp, STATUS _status, stateType stateTYPE, Animator an) : base(ag, st, hp, _status, stateTYPE, an)
 {
     attackingTime = status.getCurrentweapon.attackdelay;
     attacktimer   = attackingTime;
 }
 public IdleSM(NavMeshAgent ag, FiniStateMachine st, KitchenHelper hp, STATUS _status, stateType stateTYPE, Animator an) : base(ag, st, hp, _status, stateTYPE, an)
 {
 }
 public MakeCakeSM(NavMeshAgent ag, FiniStateMachine st, KitchenHelper hp, STATUS _status, stateType stateTYPE, Animator an) : base(ag, st, hp, _status, stateTYPE, an)
 {
     helper.onReciveMaterial += OnReciveMaterial;
     pettingrange             = status.pettingrange;
 }