Beispiel #1
0
 void Awake()
 {
     gameData = GameObject.FindGameObjectWithTag("GameController");
     agent = GetComponent<NavMeshAgent>();
     data = gameData.GetComponent<GameData>();
     hash = gameData.GetComponent<HashIDs>();
     lightLevels = GameObject.FindGameObjectWithTag("LightLevels").GetComponent<LightLevels>();
 }
Beispiel #2
0
        public void SendRoomDescription(Room room, bool brief = false)
        {
            var message = new RoomDescriptionMessage()
            {
                IsCurrentRoom = room == this.Room
            };

            var illumination = room.Illumination + Illumination;

            message.LightLevel = LightLevels.Get(illumination);


            if (LightLevels.IsTooDarkToSee(message.LightLevel))
            {
                // Too dark to see. Send the light information and that's it.
                message.CannotSee = true;
                SendMessage(message);
                return;
            }

            //TODO: Check to see if the user is blind? Somehow. I have no idea yet.

            if (!brief)
            {
                message.Description = room.TextBlock.Text;
            }

            message.Name   = room.Name;
            message.RoomId = room.Id;

            var exits = room.GetExits();

            message.Exits        = exits.Select(x => new ExitDescription(x, room)).ToArray();
            message.Actors       = room.VisibleActors(this).Select(x => new ActorDescription(x)).ToArray();
            message.VisibleItems = room.Items.Where(x => x.HiddenTime == null).OrderBy(x => x.Name).Select(x => new ItemDescription(x)).ToArray();
            message.VisibleCash  = Game.Data.AllCurrencies.Select(x => new CurrencyDescription(x, room.GetCash(x))).Where(x => x.Amount != 0).ToArray();

            message.FoundItems = room.Items.Where(x => x.HiddenTime != null && x.UsersWhoFoundMe.Contains(this)).OrderBy(x => x.Name).Select(x => new ItemDescription(x)).ToArray();
            message.FoundCash  = room.GetTotalCashUserCanSee(this).Where(x => x.KnownHidden > 0).Select(x => new CurrencyDescription(x.Currency, x.KnownHidden)).ToArray();

            SendMessage(message);
        }
Beispiel #3
0
 void Awake()
 {
     lightLevels = GameObject.FindGameObjectWithTag("LightLevels").GetComponent<LightLevels>();
 }
Beispiel #4
0
        protected override void Parse(BigEndianReader reader)
        {
            reader.ReadByte();             // ID

            _LightLevel = (LightLevels)reader.ReadByte();
        }
Beispiel #5
0
    void Awake()
    {
        blinker = transform.FindChild ("Flash");
        if(blinker == null) Debug.LogError ("EnemyFlash Projector Not Found!");
        rigidbody = GetComponent<Rigidbody> ();
        globalData = GameObject.FindGameObjectWithTag("GameController");
        damageCalculator = globalData.GetComponent<DamageCalculator>();
        animator = GetComponent<Animator>();
        hash = globalData.GetComponent<HashIDs>();
        gameData = globalData.GetComponent<GameData>();
        agent = GetComponent<NavMeshAgent>();
        blinkShader = Shader.Find("Reflective/Bumped Diffuse");
        lightLevels = GameObject.FindGameObjectWithTag("LightLevels").GetComponent<LightLevels>();
        audio = GetComponent<AudioSource>();
        lifeBar = GameObject.Find ("EnemyLife").GetComponent<Slider>();

        //GET PLAYER
        playerObject = GameObject.FindWithTag("Player"); //Get player container
        if(playerObject != null) {
            player = playerObject.transform;
            playerAnimator = player.GetComponent<Animator>();
        }
        col = GetComponent<SphereCollider>();

        if (body != null) {
            materials = body.GetComponent<SkinnedMeshRenderer>().materials;
            colors = new Color[materials.Length];
            storeColors();
            regularShader = materials[0].shader;
        }

        if(selfWeaponData == null && changesElementWithWeather) Debug.LogError("WeaponData on enemy body not referenced!");
        originalElement = element;

        if(changesElementWithWeather) swapElement();
    }
Beispiel #6
0
 // Use this for initialization
 void Awake()
 {
     audio = GetComponent<AudioSource> ();
     text = GetComponent<Text>();
     lightLevels = GameObject.FindGameObjectWithTag("LightLevels").GetComponent<LightLevels>();
 }
Beispiel #7
0
 // Update is called once per frame
 void Awake()
 {
     light = GetComponent<SpriteRenderer>().material;
     lightLevels = GameObject.FindGameObjectWithTag ("LightLevels").GetComponent<LightLevels>();
     w = GameObject.FindGameObjectWithTag ("Weather").GetComponent<WeatherSync>();
 }
Beispiel #8
0
 void Awake()
 {
     //ACCESS TO HASHES, ANIMATOR AND GLOBAL DATA
     audio = GetComponent<AudioSource> ();
     globalData = GameObject.FindGameObjectWithTag("GameController");
     looker = GameObject.FindGameObjectWithTag("CamFollow").GetComponent<CamLooker>();
     follow = GameObject.FindWithTag("CamFollow").transform;
     hash = globalData.GetComponent<HashIDs>();
     gameData = globalData.GetComponent<GameData>();
     controller = GetComponent<CharacterController>();
     animator = GetComponent<Animator>();
     lightLevels = GameObject.FindGameObjectWithTag("LightLevels").GetComponent<LightLevels>();
     damageCalculator = globalData.GetComponent<DamageCalculator>();
     agent = GetComponent<NavMeshAgent> ();
     blinker = transform.FindChild ("Flash");
     swapper = GameObject.FindWithTag("PlayerSwapper").transform;
     Vector3 startingPos = new Vector3(transform.position.x, 0, transform.position.z);
     transform.position = startingPos;
     voice = transform.FindChild ("Voice").GetComponent<AudioSource>();
     originalVolume = voice.volume;
     originalPitch = voice.pitch;
     if(body!=null) {
         mesh = body.GetComponent<SkinnedMeshRenderer>();
         toggleBlendShape(0);
     }
     meshObjects = transform.FindChild ("Body").gameObject;
     if(weaponObject!=null) weaponMeshRenderer = weaponObject.GetComponent<MeshRenderer>();
 }
Beispiel #9
0
        protected override void Parse( BigEndianReader reader )
        {
            reader.ReadByte(); // ID

            _LightLevel = (LightLevels) reader.ReadByte();
        }