Exemplo n.º 1
0
        private void ShareFogVision()
        {
            GameObject playerPokemon = GameObject.FindWithTag("CameraTarget");

            if (playerPokemon == null)
            {
                Debug.LogError("Error: Pokemon not registered.");
            }
            else
            {
                int myTeam = playerPokemon.GetComponent <EntityManager>().team;

                foreach (EntityManager em in SceneHelper.GetContainer(Container.Entities).GetComponentsInChildren <EntityManager>())
                {
                    GameObject entity = em.gameObject;

                    if (em.team == myTeam)
                    {
                        if (entity.GetComponent <FOWRevealer>() == null)
                        {
                            FOWRevealer fow = entity.AddComponent <FOWRevealer>();
                            fow.range            = new Vector2(0.5f, 40f);
                            fow.lineOfSightCheck = FOWSystem.LOSChecks.EveryUpdate;
                        }
                    }
                    else
                    {
                        if (entity.GetComponent <FOWRenderers>() == null)
                        {
                            entity.AddComponent <FOWRenderers>();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void SetMine()
        {
            isMine = true;

            // Player controller list network management.
            GameObject[] pokemonList = GameObject.FindGameObjectsWithTag("CameraTarget");
            foreach (GameObject pokemon in pokemonList)
            {
                if (pokemon != gameObject)
                {
                    pokemon.tag = "Untagged";
                }
            }

            // Camera list network management.
            GameObject[] cameraList = GameObject.FindGameObjectsWithTag("MainCamera");
            foreach (GameObject cam in cameraList)
            {
                Destroy(cam);
            }
            GameObject camera = (GameObject)Instantiate(Resources.Load("Camera/PlayerCamera"), new Vector3(transform.position.x, 5f, transform.position.z), Quaternion.identity);

            camera.tag = "MainCamera";
            myCam      = camera.GetComponentInChildren <Camera>();

            // We add a Fog of War revealer.
            FOWRevealer fow = gameObject.AddComponent <FOWRevealer>();

            fow.range            = new Vector2(0.5f, 40f);
            fow.lineOfSightCheck = FOWSystem.LOSChecks.EveryUpdate;
        }
Exemplo n.º 3
0
    public override void Init(NPC n)
    {
        base.Apply(n);
        if (n is Player)
        {
            Player p = n as Player;

            fow           = p.GO.GetComponentInChildren <FOWRevealer>();
            originalRange = fow.range;
            fow.range     = new Vector2(0f, .3f);
            n.CreateTextMessage("You feel yourself going blind...");
        }
    }
Exemplo n.º 4
0
 private void Awake()
 {
     if (this.m_fowrevealer == null)
     {
         this.m_fowrevealer = new FOWRevealer();
         if (this.isstatic)
         {
             this.m_fowrevealer.Create(base.transform, this.fog_range, FOWSystem.LOSChecks.Static, false);
         }
         else
         {
             this.m_fowrevealer.Create(base.transform, this.fog_range, FOWSystem.LOSChecks.EveryUpdate, false);
         }
     }
 }
 // Use this for initialization
 void Start()
 {
     fowRevealer         = gameObject.AddComponent <FOWRevealer>();
     fowRevealer.enabled = true;
 }
Exemplo n.º 6
0
 public abstract void Release(FOWRevealer obj);