示例#1
0
 public void SetBotInDropZone(RobotBehaviour rb, PointsDrop pd)
 {
     WaitingList.RemoveAt(0);
     if (pd == PointsDrop.DROPRIGHT)
     {
         CorrectBot = rb;
     }
     else
     {
         IncorrectBot = rb;
     }
 }
示例#2
0
    /// <summary>
    /// Handles the gonna drop.
    /// </summary>
    /// <returns><c>true</c>, if gonna drop was handled, <c>false</c> otherwise.</returns>
    bool HandleGonnaDrop()
    {
        DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper;
        PointsDrop     can_    = dropper.WhatDrop(gameObject.GetInstanceID());
        Vector3        pt      = dropper.GetPoint(can_ == PointsDrop.DROPRIGHT ? PointsDrop.VENTCORRECT : PointsDrop.VENTINCORRECT);

        transform.LookAt(pt);
        droppedInRight = dropper.WhereIsHe();
        if (_rm.IsHeLookingAt(pt))
        {
            _currentState = RobotState.LEAVEBOX;
            return(dropper.WhereIsHe());
        }
        return(dropper.WhereIsHe());
    }
示例#3
0
    void HandleInWaitZone()
    {
        DropPointLogic dropper_ = _door.GetComponent <DoorRobotInteraction>().dropper;
        PointsDrop     can      = dropper_.WhatDrop(gameObject.GetInstanceID());

        _op.SetTarget(_currentBoxPicked.box);
        _op.Stay();
        dropper_.waitZone = this;
        if (can != PointsDrop.NOTHING)
        {
            _rm.Move(dropper_.GetPoint(can));
            if (_rm.IsHeNearInstance(dropper_.GetPoint(can)))
            {
                dropper_.SetIDLE();
                dropper_.SetBotInDropZone(this, can);
                // Debug.Log("WE ARE GODS");
                _currentState     = RobotState.GONNADROP;
                dropper_.waitZone = null;
            }
        }
    }
示例#4
0
    bool HandleGonnaDrop()
    {
        DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper;
        PointsDrop     can_    = dropper.WhatDrop(gameObject.GetInstanceID());
        Vector3        pt      = dropper.GetPoint(can_ == PointsDrop.DROPRIGHT ? PointsDrop.VENTCORRECT : PointsDrop.VENTINCORRECT);

        transform.LookAt(pt);
        //if (dropper.WhereIsHe())
        //{
        //    what = true; //if he's going to the correct path, go true
        //}
        //else what = false; //if not, go false.
        droppedInRight = dropper.WhereIsHe();
        if (_rm.IsHeLookingAt(pt))
        {
            _currentState = RobotState.LEAVEBOX;
            //   Debug.Log("Yo i'm lookin at the droppah");
            return(dropper.WhereIsHe());
        }
        return(dropper.WhereIsHe());
    }
示例#5
0
    /// <summary>
    /// Handles the exit dropper.
    /// </summary>
    /// <param name="isRight">If set to <c>true</c> is right.</param>
    void HandleExitDropper(bool isRight)
    {
        DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper;
        PointsDrop     use     = PointsDrop.EXITCORRECT;

        if (isRight)
        {
            use = PointsDrop.EXITCORRECT;
            _rm.Move(dropper.GetPoint(use));
        }
        else
        {
            use = PointsDrop.EXITINCORRECT;
            _rm.Move(dropper.GetPoint(use));
        }

        if (_rm.IsHeNearInstance(dropper.GetPoint(use)))
        {
            _door         = null;
            _currentState = RobotState.SEARCH;
        }
    }
示例#6
0
    public Vector3 GetPoint(PointsDrop desiredPoint)
    {
        int desiredInt = (int)desiredPoint;

        return(paths[desiredInt].position);
    }
示例#7
0
    // Called every frame. 'delta' is the elapsed time since the previous frame.
    public override void _Process(float delta)
    {
        if (playerKinematic.IsEndGame())
        {
            playerKinematic.EndGame(timeSurvived, round, killCount);
            highScoreSaveData.AddScore(round, levelIndex);
            if (!saved)
            {
                saved = true;
                SaveGame();
            }
        }
        else
        {
            timeSurvived += delta;

            for (int i = 0; i < maxEnemies; i++)
            {
                if (enemies[i] != null)
                {
                    if (enemies[i].ToRemove())
                    {
                        if (random.NextDouble() < 0.1)
                        {
                            PointsDrop pointsDrop = (PointsDrop)PointsDropScene.Instance();
                            pointsDrop.Position = enemies[i].Position;
                            AddChild(pointsDrop);
                        }
                        else if (random.NextDouble() < 0.1)
                        {
                            HealthDropNode healthDrop = (HealthDropNode)HealthDropScene.Instance();
                            healthDrop.Position = enemies[i].Position;
                            AddChild(healthDrop);
                        }
                        else if (random.NextDouble() < 0.01)
                        {
                            DamageDrop damageDrop = (DamageDrop)DamageDropScene.Instance();
                            damageDrop.Position = enemies[i].Position;
                            AddChild(damageDrop);
                        }

                        enemies[i].QueueFree();
                        enemies[i] = null;
                        deadEnemies++;
                        playerKinematic.Spend(-10);
                        playerKinematic.EnemyKilled();
                        playerKinematic.SetEnemiesLeft(maxEnemies - deadEnemies);
                        killCount++;
                    }
                }
            }

            if (maxEnemies - deadEnemies == 0)
            {
                this.playerKinematic.SetRoundState(RoundState.TOWER_DEFENCE);
                roundState  = RoundState.TOWER_DEFENCE;
                deadEnemies = 0;
                betweenRoundTimer.Start();
            }
        }
    }