Example #1
0
    public void SetVislble(bool visible)
    {
        isVisible = visible;
        if (isVisible)
        {
            playerVisibility = GetComponent <PlayerVisibility>();
            foreach (Empire empire in empires)
            {
                playerVisibility.AddEmpire(empire);
                foreach (SolarSystem system in empire.GetSystems())
                {
                    if (system.GetComponent <PlayerBuildingController>().GetPlayerSpyNetwork(this))
                    {
                        playerVisibility.AddObject(system.gameObject);
                    }
                }
            }
            foreach (GameObject agent in agents)
            {
                playerVisibility.AddObject(agent);
            }

            foreach (PlayerBase playerBase in playerBases)
            {
                playerVisibility.AddObject(playerBase.gameObject);
            }
        }
        else
        {
            playerVisibility = null;
        }
    }
Example #2
0
 void Start()
 {
     player     = LevelAccess.GetPlayerPos();
     visibility = player.GetComponent <PlayerVisibility>();
     //resetPlayerPosition = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerPos>();
     //resetEnemiesPosition = GameObject.FindGameObjectsWithTag("Enemy");
     gameFlowController = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>();
 }
Example #3
0
 void Start()
 {
     playerDetected   = false;
     playerLocation   = LevelAccess.GetPlayerPos();
     playerVisibility = playerLocation.GetComponent <PlayerVisibility>();
     destination      = GetComponent <AIDestinationSetter>();
     waitTime         = startWaitTime;
     Init();
 }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     slider      = transform.parent.Find("EnemyAnimator/Canvas/Slider").gameObject.GetComponent <Slider>();
     player      = LevelAccess.GetPlayerPos();
     patrol      = GetComponent <EnemyPatrol>();
     visibility  = player.GetComponent <PlayerVisibility>();
     catchAmount = 0f;
     caught      = false;
     outside     = true;
     slider.gameObject.SetActive(false);
     gfc = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>();
 }
Example #5
0
    void Awake()
    {
        behavior  = GetComponent <BehaviorTree>();
        agent     = GetComponent <NavMeshAgent>();
        detection = GetComponent <ConeDetection>();
        attack    = GetComponent <EnemyAttack>();

        player     = GameObject.FindGameObjectWithTag("Player");
        visibility = player.GetComponent <PlayerVisibility>();

        GlobalVariables.Instance.SetVariableValue("Player", player);

        brokenEffect.SetActive(false);
    }
Example #6
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         playerInRange = true;
         if (player == null)
         {
             feedback.text    = "";
             player           = collision.gameObject;
             slider           = player.transform.Find("Canvas/Slider").gameObject.GetComponent <Slider>();
             playerVisibility = player.GetComponent <PlayerVisibility>();
             playerMovement   = player.GetComponent <PlayerMovement>();
             playerCollision  = player.GetComponent <Collider2D>();
         }
         else
         {
             feedback.text = "Hold Space to Haunt";
         }
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     enemy      = GetComponent <EnemyConstantRotation>();
     visibility = player.GetComponent <PlayerVisibility>();
 }
Example #8
0
 void OnEnterPlayerVisibility(PlayerVisibility vis)
 {
     playerHasSeen = true;
 }
Example #9
0
 // Use this for initialization
 void Start()
 {
     visibility = gameObject.GetComponentInChildren <PlayerVisibility>();
     health     = initHealth;
 }
Example #10
0
 public void SetVisibilityState(PlayerVisibility visibility)
 {
     animCtrl.SetInteger("Visibility", (int)visibility);
 }
Example #11
0
 public void SetVisibility(PlayerVisibility visibility)
 {
     this.Visibility = visibility;
     animCtrl.SetVisibilityState(visibility);
 }
Example #12
0
 // Start is called before the first frame update
 void Start()
 {
     enemy      = GetComponent <EnemyRandomRotation>();
     visibility = player.GetComponent <PlayerVisibility>();
 }
Example #13
0
 // Start is called before the first frame update
 void Start()
 {
     visibility = player.GetComponent <PlayerVisibility>();
 }
Example #14
0
 void Awake()
 {
     instance = this;
 }
Example #15
0
 void OnEnterPlayerVisibility( PlayerVisibility vis )
 {
     playerHasSeen = true;
 }
Example #16
0
 // Use this for initialization
 void Start()
 {
     visibility = gameObject.GetComponentInChildren<PlayerVisibility>();
     health = initHealth;
 }
Example #17
0
    // Use this for initialization
    void Start()
    {
        m_rigidbody2d = GetComponent<Rigidbody2D>();
        m_material = GetComponent<Renderer>().material;
        m_gamepad = GetComponent<HFTGamepad>();

        visibility = gameObject.GetComponent<PlayerVisibility>();

        PlayerManager.AddPlayer(this);
        SetChasing(PlayerManager.ShouldISeek());
        int playerNumber = UnityEngine.Random.Range(0,100);//PlayerManager.NumberPlayers;
        SetColor(playerNumber-1);
        SetName(m_gamepad.Name);

        // Notify us if the name changes.
        m_gamepad.OnNameChange += ChangeName;

        score.catchPlayerEvent += delegate() {
            //visibility.StartBlinking();
            //refreshName();
            m_netPlayer.SendCmd("showGif", new CustomTextParcel("Tom is lazy"));
        };
        score.caughtEvent += delegate ()
        {
            //visibility.PermanentOn();
            if(!justCaught)
            {
                m_netPlayer.SendCmd("showGif", new CustomTextParcel("Tom is lazy"));
                m_netPlayer.SendCmd("customText", new CustomTextParcel("You've been caught! Wait till next round."));
                gameObject.AddComponent<PlayerStartScreen>();

                PlayerManager.NumberCaught++;
                Debug.Log("So far caught: " + PlayerManager.NumberCaught);

                //See if the game ends!
                if (PlayerManager.NumberHiding == PlayerManager.NumberCaught)
                {
                    RoundManager.Instance.EndGame(true); //seekers win
                }
                justCaught = true;
            }
        };

        //refreshName();
    }