コード例 #1
0
    void Start()
    {
        EventCenter.GetInstance().AddEventListener("TransitData", () => {
            List <string> tmpBehav = new List <string>();
            foreach (var item in viewers)
            {
                if (item.toggleObject.isOn)
                {
                    tmpBehav.Add(item.toggleSelection.text);
                }
            }
            _protagonist.UpdateBehaviourSelect(tmpBehav);
        });

        EventCenter.GetInstance().AddEventListener("UpdateUI", UpdateBehavPanel);

        _protagonist = GameManager.instance.playerAgent.GetComponent <Protagonist>();
        viewers      = transform.GetComponentsInChildren <CustomToggle>();

        foreach (var behav in _protagonist.behaviours._behaviourList)
        {
            if (!behavDic.ContainsKey(behav._availibleStage))
            {
                behavDic.Add(behav._availibleStage, new List <string>());
            }
            behavDic[behav._availibleStage].Add(behav._name);
        }
        UpdateBehavPanel();
    }
コード例 #2
0
        public static void UpdateOrbDamage(GameSave save, Protagonist lunais)
        {
            var OrbManagerType   = TimeSpinnerType.Get("Timespinner.GameObjects.Heroes.Orbs.LunaisOrbManager");
            var RefreshDamage    = OrbManagerType.GetMethod("RefreshDamage", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            var orbManager       = lunais.AsDynamic()._orbManager;
            var inventory        = save.Inventory;
            var currentOrbAType  = inventory.EquippedMeleeOrbA;
            var currentOrbBType  = inventory.EquippedMeleeOrbB;
            var currentSpellType = inventory.EquippedSpellOrb;
            var currentRingType  = inventory.EquippedPassiveOrb;
            var orbA             = GetOrbFromType(inventory.OrbInventory, currentOrbAType);
            var orbB             = GetOrbFromType(inventory.OrbInventory, currentOrbBType);
            var spell            = GetOrbFromType(inventory.OrbInventory, currentSpellType);
            var ring             = GetOrbFromType(inventory.OrbInventory, currentRingType);

            if (orbA != null)
            {
                SetOrbBaseDamage(orbA);
            }
            if (orbB != null)
            {
                SetOrbBaseDamage(orbB);
            }
            if (spell != null)
            {
                SetOrbBaseDamage(spell);
            }
            if (ring != null)
            {
                SetOrbBaseDamage(ring);
            }
            RefreshDamage.Invoke(orbManager, null);
        }
コード例 #3
0
    private IEnumerator StartDash(Protagonist battler)
    {
        CharacterController cc = battler.GetComponent <CharacterController>();

        cc.detectCollisions = false;

        Vector3 direction = battler.movementInput;

        if (direction == Vector3.zero)
        {
            direction = battler.transform.forward;
        }
        battler.transform.forward = direction;


        while (startTime + Duration > Time.time)
        {
            cc.Move(direction.normalized * _speed * Time.deltaTime);
            cc.Move(new Vector3(0, -10f * Time.deltaTime, 0));
            yield return(null);
        }

        cc.detectCollisions = true;
        battler.StartCoroutine(Done(battler));
    }
コード例 #4
0
    private void Spawn(int spawnIndex)
    {
        Transform   spawnLocation  = GetSpawnLocation(spawnIndex, _spawnLocations);
        Protagonist playerInstance = InstantiatePlayer(_playerPrefab, spawnLocation, _cameraManager);

        SetupCameras(playerInstance);
    }
コード例 #5
0
 public void All(IList <IHostile> hostiles, Protagonist protagonist,
                 IList <GameEvent> events)
 {
     Hostiles(hostiles);
     Agent(protagonist, Settings.Color.Protagonist);
     Events(events);
 }
コード例 #6
0
ファイル: SpawnSystem.cs プロジェクト: kamyker/open-project-1
    private void Spawn(int spawnIndex)
    {
        Transform   spawnLocation  = GetSpawnLocation(spawnIndex, _spawnLocations);
        Protagonist playerInstance = InstantiatePlayer(_playerPrefab, spawnLocation);

        _playerInstantiatedChannel.RaiseEvent(playerInstance.transform);         // The CameraSystem will pick this up to frame the player
    }
コード例 #7
0
 void Start()
 {
     animator    = GetComponent <Animator>();
     protagonist = GetComponent <Protagonist>();
     tempStage   = protagonist.GetStage();
     EventCenter.GetInstance().AddEventListener("UpdateAnimation", UpdateAnimation);
 }
コード例 #8
0
        public void Protagonist_is_initialised_with_non_null_attributes()
        {
            var protagonist = new Protagonist();

            Assert.That(protagonist.Skill, Is.Not.Null);
            Assert.That(protagonist.Stamina, Is.Not.Null);
            Assert.That(protagonist.Luck, Is.Not.Null);
        }
コード例 #9
0
    void Spawn(Protagonist player, Vector3 pos, Quaternion rot)
    {
        player.characterController.enabled = false; //Disable the controller due to it interfering with changing the position directly
        player.transform.position          = pos;
        player.characterController.enabled = true;

        player.transform.rotation = rot;
    }
コード例 #10
0
 public Navigation(Protagonist protagonist, List <PointBox> events, List <Hostile> hostiles, Game game)
 {
     this.currentScore = 0;
     this.protagonist  = protagonist;
     this.events       = events;
     this.hostiles     = hostiles;
     this.game         = game;
 }
コード例 #11
0
    private void Spawn(int spawnIndex)
    {
        Transform   spawnLocation  = GetSpawnLocation(spawnIndex, _spawnLocations);
        Protagonist playerInstance = InstantiatePlayer(_playerPrefab, spawnLocation);

        Debug.Log(spawnLocation);
        Debug.Log(playerInstance);
        _cameraManager.Follow = playerInstance.transform;
    }
コード例 #12
0
	// ----------------------------------------------
	// INIT/DESTROY
	// ----------------------------------------------	
	
	// -------------------------------------------
	/* 
	 * Start		
	 */
	void Start () 
	{	
		// SET THE PROTAGONIST GOAL
		GameObject protagonistModel = GameObject.FindGameObjectWithTag(Global.PLAYER_TAG);	
		if (protagonistModel!=null)
		{
			m_protagonist = protagonistModel.GetComponent<Protagonist>();
		}		
	}
コード例 #13
0
 void Start()
 {
     _protagonist    = GameManager.instance.playerAgent.GetComponent <Protagonist>();
     _moneyOnUI.text = _protagonist.GetMoney().ToString();
     _ageOnUI.text   = _protagonist.GetAge().ToString();
     EventCenter.GetInstance().AddEventListener("UpdateUI", () => {
         _moneyOnUI.text = _protagonist.GetMoney().ToString();
         _ageOnUI.text   = _protagonist.GetAge().ToString();
     });
 }
コード例 #14
0
    private void SpawnPlayer()
    {
        Protagonist playerInstance = InstantiatePlayer(_playerPrefab, GetSpawnLocation());

        _playerInstantiatedChannel.RaiseEvent(playerInstance.transform);         // The CameraSystem will pick this up to frame the player
        _playerTransformAnchor.Transform = playerInstance.transform;

        //TODO: Probably move this to the GameManager once it's up and running
        _inputReader.EnableGameplayInput();
    }
コード例 #15
0
    public void Launch(Protagonist shooter, Direction direction, float speed = 7.5f)
    {
        this.cmp_rigidbody.velocity = Vector2.zero;         // Reset the velocity
        this.shooter            = shooter;
        this.transform.position = this.shooter.ShootPoint;  // Reset the position of the bullet

        this.gameObject.SetActive(true);                    // Show the weapon
        this.cmp_collider.enabled = true;                   // Activates collider

        this.cmp_rigidbody.velocity = DirectionGuide.getDirection(direction).ToVector2() * speed;
    }
コード例 #16
0
        public void ProcessHostilesAndGetScores(Protagonist protagonist, Game game)
        {
            int points = 0;

            foreach (var hostile in this.hostiles)
            {
                if (protagonist.X < hostile.X)
                {
                    hostile.Move(-1, 0);
                }
                if (protagonist.X > hostile.X)
                {
                    hostile.Move(1, 0);
                }
                if (protagonist.Y < hostile.Y)
                {
                    hostile.Move(0, -1);
                }
                if (protagonist.Y > hostile.Y)
                {
                    hostile.Move(0, 1);
                }
                var overlapCount = 0;
                foreach (var h in this.hostiles)
                {
                    if (hostile.Y == h.Y && hostile.X == h.X)
                    {
                        overlapCount++;
                    }
                }

                if (overlapCount > 1)
                {
                    ++this.counter;
                    Overlap();
                }

                if (protagonist.Y == hostile.Y && protagonist.X == hostile.X)
                {
                    if (game.Lives > 0)
                    {
                        game.DecreaseLive();

                        game.AddScore(Settings.Game.LoseLifePenalty);
                        points -= Settings.Game.LoseLifePenalty;
                        hostile.RandomReset();
                    }
                    else
                    {
                        game.End();
                    }
                }
            }
        }
コード例 #17
0
    private void SpawnPlayer()
    {
        Transform   spawnLocation  = GetSpawnLocation();
        Protagonist playerInstance = Instantiate(_playerPrefab, spawnLocation.position, spawnLocation.rotation);

        _playerInstantiatedChannel.RaiseEvent(playerInstance.transform);
        _playerTransformAnchor.Provide(playerInstance.transform);         //the CameraSystem will pick this up to frame the player

        //TODO: Probably move this to the GameManager once it's up and running
        _inputReader.EnableGameplayInput();
    }
コード例 #18
0
    private Protagonist InstantiatePlayer(Protagonist playerPrefab, Transform spawnLocation)
    {
        if (playerPrefab == null)
        {
            throw new Exception("Player Prefab can't be null.");
        }

        Protagonist playerInstance = Instantiate(playerPrefab, spawnLocation.position, spawnLocation.rotation);

        return(playerInstance);
    }
コード例 #19
0
    void Awake()
    {
        level       = GameObject.FindGameObjectWithTag("Level");
        levelScript = level.GetComponent <Level> ();

        protagonist       = GameObject.Find("Protagonist");
        protagonistScript = protagonist.GetComponent <Protagonist> ();

        backgroundScript = GameObject.Find("Background").GetComponent <ParallaxBackground> ();
        symbolScript     = GameObject.Find("Symbol").GetComponent <Symbol>();
    }
コード例 #20
0
ファイル: GameStateSystem.cs プロジェクト: sxwx/Shooter
        public GameStateSystem(Protagonist protagonist, WeaponSystem weaponSystem, GameInputSystem gameInputSystem,
                               SignalBus signalBus, SettingsSystem settingsSystem, StartScreenView startScreenView, SettingsView settingsView)
        {
            _protagonist     = protagonist;
            _weaponSystem    = weaponSystem;
            _settingsSystem  = settingsSystem;
            _gameInputSystem = gameInputSystem;
            _signalBus       = signalBus;

            _startScreenView = startScreenView;
            _settingsView    = settingsView;
        }
コード例 #21
0
 public Engine(Protagonist protagonist, List <GameEvent> events, List <IHostile> hostiles, Game game, MovementHandler movementHandler, EventsProcessor eventsProcessor, HostilesProcessor hostilesProcessor, Board board, Information information, Menu menu)
 {
     this.protagonist       = protagonist;
     this.events            = events;
     this.hostiles          = hostiles;
     this.game              = game;
     this.movementHandler   = movementHandler;
     this.eventsProcessor   = eventsProcessor;
     this.hostilesProcessor = hostilesProcessor;
     this.board             = board;
     this.information       = information;
     this.menu              = menu;
 }
コード例 #22
0
ファイル: Food.cs プロジェクト: Ibraheem-Aredda/CaveSurvivor
 public override void Use(Protagonist trigger)
 {
     if (!this.isWrapped)
     // If it's unwrapped, then the protagonist can take the exposed item
     {
         // Consume
         trigger.Profit(this.health, this.fill, 0);
         // The moving objects can consider this cell as walkable
         trigger.GameManager.CaveGenerator.MarkCellAsWalkable(this.cell);
         // Consume and dispsoe
         trigger.GameManager.Dispose(this);      // Dispose of this object right away
     }
 }
コード例 #23
0
ファイル: TraitPanel.cs プロジェクト: HuangJing0911/LifeSim
    void Start()
    {
        _protagonist = GameManager.instance.playerAgent.GetComponent <Protagonist>();

        foreach (var name in _protagonist.GetTraitsList().Keys)
        {
            GameObject traitContent = ResourceManager.GetInstance().Load <GameObject>("UI/traitUI");
            traitContent.transform.SetParent(this.transform);
            traitContent.transform.localScale = Vector3.one;
            traitContent.GetComponentInChildren <TextMeshProUGUI>().text = name;
            traitContent.GetComponent <Button>().onClick.AddListener(() => {
                EventCenter.GetInstance().EventTrigger <(string, string)>("TIPS", (name, _protagonist.GetTraitsList()[name]));
            });
        }
    }
コード例 #24
0
    private void InstantiateProtagonist()
    {
        //avoid double instantiate
        if (_protagonist.isActiveAndEnabled)
        {
            return;
        }

        Protagonist temp = Instantiate <Protagonist>(_protagonist);

        temp.Init(_cameraController, StaticData.DefaultRebirthVector);
        _protagonist = temp;

        SetScale();
    }
コード例 #25
0
    public void StrikeEnded(Battler user, Vector3 swordDefaultPos, Vector3 swordDefaultRot, Transform swordHand)
    {
        Animator[] animators = user.GetComponentsInChildren <Animator>();
        animators.PlayAll((int id) =>
        {
            animators[id].speed = 1;
        });
        ShowBody(true, user);

        Protagonist protagonist = user as Protagonist;

        protagonist.GetComponentInChildren <DamageDealerTrigger>().Enable(Damage);

        GameObject sword = GameObject.FindGameObjectWithTag("PlayerSword");

        sword.transform.parent           = swordHand;
        sword.transform.localPosition    = swordDefaultPos;
        sword.transform.localEulerAngles = swordDefaultRot;
        sword.GetComponentInChildren <TrailRenderer>().emitting = false;
    }
コード例 #26
0
    void Start()
    {
        EventCenter.GetInstance().AddEventListener("UpdateUI", UpdateOnUI);
        _protagonist = GameManager.instance.playerAgent.GetComponent <Protagonist>();
        _progressBar = new Dictionary <string, ProgressBar>();

        ProgressBar[] viewers = transform.Find("Content").GetComponentsInChildren <ProgressBar>();
        foreach (var item in viewers)
        {
            item.speed = 3;
            _progressBar.Add(item.name, item);
        }

        // 初始化健康、精神和模块最大值
        _progressBar["PB - Health"].maxValue  = _protagonist.maxHealth;
        _progressBar["PB - Sans"].maxValue    = _protagonist.maxSans;
        _progressBar["PB - Motor"].maxValue   = _protagonist.maxMoudle;
        _progressBar["PB - Nerve"].maxValue   = _protagonist.maxMoudle;
        _progressBar["PB - Endoc"].maxValue   = _protagonist.maxMoudle;
        _progressBar["PB - Circul"].maxValue  = _protagonist.maxMoudle;
        _progressBar["PB - Breath"].maxValue  = _protagonist.maxMoudle;
        _progressBar["PB - Digest"].maxValue  = _protagonist.maxMoudle;
        _progressBar["PB - Urinary"].maxValue = _protagonist.maxMoudle;
        _progressBar["PB - Reprod"].maxValue  = _protagonist.maxMoudle;

        // 初始化当前显示数据
        module = _protagonist.GetModule();
        _progressBar["PB - Health"].currentPercent  = _protagonist.GetHealth();
        _progressBar["PB - Sans"].currentPercent    = _protagonist.GetSans();
        _progressBar["PB - Motor"].currentPercent   = module[0];
        _progressBar["PB - Nerve"].currentPercent   = module[1];
        _progressBar["PB - Endoc"].currentPercent   = module[2];
        _progressBar["PB - Circul"].currentPercent  = module[3];
        _progressBar["PB - Breath"].currentPercent  = module[4];
        _progressBar["PB - Digest"].currentPercent  = module[5];
        _progressBar["PB - Urinary"].currentPercent = module[6];
        _progressBar["PB - Reprod"].currentPercent  = module[7];

        UpdateOnUI();
    }
コード例 #27
0
        public int ProcessEventsAndGetScores(Protagonist protagonist, Game game)
        {
            int points = 0;

            for (int i = 0; i < events.Count; i++)
            {
                var currentEvent = this.events[i];
                if (currentEvent.Y == protagonist.Y && currentEvent.X == protagonist.X)
                {
                    points += currentEvent.Activate();
                    game.AddScore(points);
                    this.MakeSound(FileSoundPath.Event);
                }
                currentEvent.TimeTrigger();
                if (!currentEvent.IsActive)
                {
                    this.events.RemoveAt(i);
                }
            }

            return(points);
        }
コード例 #28
0
    void Start()
    {
        EventCenter.GetInstance().AddEventListener("TransitData", () => {
            _protagonist.UpdateHabbitSelect(_eatSelection.text, _sleepSelection.text, _sportSelection.text, _workSelection.text);
        });

        _protagonist = GameManager.instance.playerAgent.GetComponent <Protagonist>();
        _selector    = new Dictionary <string, HorizontalSelector>();

        HorizontalSelector[] viewers = transform.Find("Content").GetComponentsInChildren <HorizontalSelector>();
        foreach (var item in viewers)
        {
            _selector.Add(item.name, item);
        }

        for (int i = 0; i < 3; i++)
        {
            _selector["EatSelector"].itemList[i].itemTitle   = _protagonist.habbits.habbitDic["Eat"][i]._name;
            _selector["WorkSelector"].itemList[i].itemTitle  = _protagonist.habbits.habbitDic["Work"][i]._name;
            _selector["SleepSelector"].itemList[i].itemTitle = _protagonist.habbits.habbitDic["Sleep"][i]._name;
            _selector["SportSelector"].itemList[i].itemTitle = _protagonist.habbits.habbitDic["Sport"][i]._name;
        }
    }
コード例 #29
0
ファイル: IOHelper.cs プロジェクト: DroneOvDread/d-spsim
        /// <summary>
        /// Imports the protagonist
        /// </summary>
        private static Protagonist ImportProtagonist(XmlDocument xml)
        {
            XmlNodeList xmlnode;
            Protagonist output = new Protagonist();

            xmlnode = xml.GetElementsByTagName(Tags.PROTAGONIST);
            XmlNode readProtagonist = xmlnode[0];

            output.Name = readProtagonist[Tags.PROTAGONIST_NAME].InnerText.Trim();
            output.Lore = readProtagonist[Tags.PROTAGONIST_LORE].InnerText.Trim();

            output.OwnRoom     = Convert.ToInt64(readProtagonist[Tags.PROTAGONIST_OWNROOM].InnerText.Trim());
            output.CurrentRoom = Convert.ToInt64(readProtagonist[Tags.PROTAGONIST_OWNROOM].InnerText.Trim());
            if (readProtagonist[Tags.PROTAGONIST_GENDER].InnerText.Trim() == "male")
            {
                output.Gender = Gender.Male;
            }
            else
            {
                output.Gender = Gender.Female;
            }

            return(output);
        }
コード例 #30
0
 public StartGame(string playerName)
 {
     while (true)
     {
         InitializeEnvironment();
         Random randomGenerator = new Random();
         Game   game            = new Game(Settings.Game.Lifes);
         game.PlayersName = playerName;
         Menu             menu        = new Menu();
         Protagonist      protagonist = new Protagonist();
         List <GameEvent> events      = new List <GameEvent>();
         List <IHostile>  hostiles    = new List <IHostile>();
         hostiles.Add(new Hostile(4, 4));
         MovementHandler     movementHandler   = new MovementHandler();
         EventsProcessor     eventsProcessor   = new EventsProcessor(events, randomGenerator);
         HostilesProcessor   hostilesProcessor = new HostilesProcessor(hostiles, game);
         Display.Board       board             = new Board();
         Display.Information information       = new Information();
         Engine         engine    = new Engine(protagonist, events, hostiles, game, movementHandler, eventsProcessor, hostilesProcessor, board, information, menu);
         ConsoleKeyInfo cki       = new ConsoleKeyInfo();
         Stopwatch      stopwatch = new Stopwatch();
         engine.Start(cki, stopwatch);
     }
 }
コード例 #31
0
ファイル: Grid.cs プロジェクト: farreltr/OneLastSunset
 void Start()
 {
     DontDestroyOnLoad (this.gameObject);
     antagonist = FindObjectOfType<Antagonist> ();
     protagonist = FindObjectOfType<Protagonist> ();
 }
コード例 #32
0
 private PocketMonster getPlayerPokemon(Protagonist player)
 {
     return(player.Pokemons.Find(x => x.CurrentHP != 0));
 }
コード例 #33
0
ファイル: Protagonist.cs プロジェクト: gmange/piscine-unity
 void Awake()
 {
     if (go == null)
         go = this;
 }