Inheritance: MonoBehaviour
	void Init(){ // refactored this because Awake could be called after the first ExpectEvents call, wiping out the settings
		if (initialized) return;
		initialized = true;

		if(target == null && transform.parent != null )
			target = transform.parent.gameObject;
		if ( target != null )
		{
			am = target.GetComponent<AnimationManager>();
			tc = target.GetComponent<TaskCharacter>();
		}
		skippedEvents = new List<string>();
		

		expectedEvents = new AnimEventList();
		expectedEvents.events = new List<AnimationEvent>();
		receivedEvents = new List<AnimationEvent>();

//		MatchingLists = new List<AnimEventList>() ;
		
		if (animEventList == null){
			Serializer<List<AnimEventList>> serializer = new Serializer<List<AnimEventList>>();
			string pathname = "XML/AnimEventList";
			animEventList = serializer.Load(pathname);
//			CheckForDuplicateClips(); // there are a lot of duplicates, we are dealing with it.
		}

	}
Exemple #2
0
 void Awake()
 {
     animationManager = GetComponent<AnimationManager>();
     attr = GetComponent<UnitAttributes>();
     movement = GetComponent<UnitMovement>();
     energyCost = 2;
 }
Exemple #3
0
    bool CanFindAnimationCollider(ref AnimationManager manager)
    {
        RaycastHit2D hit;
        hit = Physics2D.Raycast(transform.position, Vector2.zero, 100f, _layers);
        if (hit.collider == null) { manager = null; return false; }

        manager = hit.collider.GetComponentInParent<AnimationManager>();
        return true;

        /*Collider2D[] colliders = Physics2D.OverlapCircleAll((Vector2)transform.position, Camera.main.farClipPlane, _layers);

        for (int i = 0; i < colliders.Length; i++)
        {
          Vector3 vector = colliders[i].transform.position - transform.position;
          float angle = Vector3.Angle(transform.forward, vector);

          if (angle <= _light.spotAngle * 0.5f)
          {
        manager = colliders[i].GetComponentInParent<AnimationManager>();
        return true;
          }
        }

        manager = null;
        return false;*/
    }
Exemple #4
0
 void Awake()
 {
     mask = -1;
     attr = GetComponent<UnitAttributes>();
     movement = GetComponent<UnitMovement>();
     animationManager = GetComponent<AnimationManager>();
 }
 public WarPresentationModel(Situation situation)
 {
     CancelCommandStack = new Stack<Func<bool>>();
     Situation = situation;
     _chipAnimations = new AnimationManager<AnimationSprite>();
     _screenAnimations = new AnimationManager<AnimationSurface>();
 }
Exemple #6
0
        public void AnimationWeight()
        {
            var manager = new AnimationManager();
              var property = new AnimatableProperty<float>();
              var animation = new SingleFromToByAnimation
              {
            Duration = TimeSpan.FromSeconds(1.0),
            From = 100.0f,
            To = 200.0f,
              };

              var controller = manager.StartAnimation(animation, property);
              controller.AutoRecycle();
              controller.UpdateAndApply();
              Assert.AreEqual(1.0f, controller.Weight);
              Assert.AreEqual(100.0f, property.Value);

              controller.Weight = 0.5f;
              manager.Update(TimeSpan.Zero);
              manager.ApplyAnimations();
              Assert.AreEqual(50.0f, property.Value);

              controller.Stop();
              Assert.IsNaN(controller.Weight);
        }
    public void Start()
    {
        //Grab mainObject prefab to access managers effectively
        mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
        if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
        {
            GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
            for (int i = 0; i < mainObjectList.Length; ++i)
            {
                if (mainObjectList[i].GetComponent<GameStateManager>().objectSaved)
                    mainObject = mainObjectList[i];
            }
        }

        // Notice, these are attached to the MainObject
        gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
        animationManagerRef = gameStateManagerRef.GetAnimationManager();
        inputManagerRef = gameStateManagerRef.GetInputManager();
        worldCollisionRef = gameStateManagerRef.GetWorldCollision();

        // This script is attached to the player, so we use 'gameObject' here
        controllerRef = gameObject.GetComponent<TWCharacterController>();

        paperObject = GameObject.FindGameObjectWithTag("background");
    }
 // Use this for initialization
 void Start()
 {
     am = amObj.GetComponent<AnimationManager> ();
     fs = faceSelObj.GetComponent<FaceSelection> ();
     hsTracker = hsObj.GetComponent<HighscoreTracker> ();
     sc = selectionControl.GetComponent<SelectionControl> ();
     cd = clkObj.GetComponent<ClickDetection> ();
 }
 // Use this for initialization
 void Awake()
 {
     animationManager = FindObjectOfType<AnimationManager> ();
     playerManager = FindObjectOfType<PlayerManager> ();
     ConfirmSelectionMenu = GameObject.Find ("ConfirmSelectionMenu");
     playerManager.AddPlayers(this.gameObject);
     ConfirmSelectionMenuText = GameObject.Find ("ConfirmSelectionMenuText");
     audioSource = this.GetComponent<AudioSource> ();
 }
Exemple #10
0
 /// <inheritdoc/>
 protected override void OnUpdate(AnimationManager animationManager)
 {
     if (_fadeInController.State == AnimationState.Stopped)
       {
     // Fade-in has completed.
     animationManager.RemoveBefore(AnimationInstance);
     animationManager.Remove(this);
       }
 }
Exemple #11
0
	void Start(){
		//Set state character
		instace = this;
		characterController = this.GetComponent<CharacterController>();
		animationManager = this.GetComponent<AnimationManager>();
		speedMove = GameAttribute.gameAttribute.speed;
		jumpSecond = false;
		magnet.SetActive(false);
		Invoke("WaitStart",0.2f);
	}
Exemple #12
0
 /// <inheritdoc/>
 protected override void OnUpdate(AnimationManager animationManager)
 {
     if (_fadeOutController.State == AnimationState.Stopped)
       {
     // Fade-out has completed.
     animationManager.Remove(AnimationInstance);
     animationManager.Remove(this);  // (Optional: When the animation instance is removed the
                                 // transition will be removed automatically.)
       }
 }
Exemple #13
0
        /// <inheritdoc/>
        protected override void OnUpdate(AnimationManager animationManager)
        {
            if (_fadeInController.State == AnimationState.Stopped)
              {
            // Fade-in has completed.
            if (_previousAnimation.RunCount == _previousAnimationRunCount) // Do nothing, if previous animation has been recycled.
              animationManager.Remove(_previousAnimation);

            animationManager.Remove(this);
              }
        }
        // ----- ----- ----- ctor ----- ----- -----
        public WorldMapPanel(WorldMap map)
        {
            Contract.Requires(map != null);
            _reignMap = map;
            _animations = new AnimationManager<IAnimation>();

            Initialize();

            InitializeComponent();

            InitializeOtherComponent();
        }
Exemple #15
0
 /// <inheritdoc/>
 protected override void OnInitialize(AnimationManager animationManager)
 {
     // Start fade-out animation on animation weight.
       var fadeOutAnimation = new SingleFromToByAnimation
       {
     To = 0,
     Duration = _fadeOutDuration,
     EasingFunction = DefaultEase,
     FillBehavior = FillBehavior.Stop,
       };
       _fadeOutController = animationManager.StartAnimation(fadeOutAnimation, AnimationInstance.WeightProperty);
 }
Exemple #16
0
        protected override void Initialize()
        {
            // ----- Initialize Services.
              // The services are stored in Game.Services to make them accessible for all
              // game components.

              // Add the input service, which manages device input, button presses, etc.
              _inputManager = new InputManager(false);
              Services.AddService(typeof(IInputService), _inputManager);

              // Add the animation service.
              _animationManager = new AnimationManager();
              Services.AddService(typeof(IAnimationService), _animationManager);

              // Add the physics simulation to the service and add some force effects.
              // (TODO: Create a IPhysicsService that owns the simulation.)
              _simulation = new Simulation();
              _simulation.ForceEffects.Add(new Gravity());
              _simulation.ForceEffects.Add(new Damping());
              Services.AddService(typeof(Simulation), _simulation);

              // ----- Add GameComponents
              Components.Add(new GamerServicesComponent(this));               // XNA gamer services needed for avatars.
              Components.Add(new Camera(this));                               // Controls the camera.
              Components.Add(new BallShooter(this));                          // Shoot balls at the target position.
              Components.Add(new Grab(this));                                 // Allows to grab objects with the mouse/gamepad
              Components.Add(new RigidBodyRenderer(this) { DrawOrder = 10 }); // Renders all rigid bodies of the simulation.
              Components.Add(new Reticle(this) { DrawOrder = 20 });           // Draws a cross-hair for aiming.
              Components.Add(new Help(this) { DrawOrder = 30 });              // Draws help text.
              Components.Add(new Profiler(this) { DrawOrder = 40 });          // Displays profiling data.

              // Initialize the sample factory methods. All samples must be added to this
              // array to be shown.
              _createSampleDelegates = new Func<Sample>[]
              {
            () => new BasicAvatarSample(this),
            () => new WrappedAnimationSample(this),
            () => new BakedAnimationSample(this),
            () => new CustomAnimationSample(this),
            () => new AttachmentSample(this),
            () => new RagdollSample(this),
            () => new AdvancedRagdollSample(this),
              };

              // Start the first sample in the array.
              _activeSampleIndex = 0;
              _activeSample = _createSampleDelegates[0]();
              Components.Add(_activeSample);

              base.Initialize();
        }
Exemple #17
0
        public void BlendGroupWithAnimationAndTimelineGroups()
        {
            var testObject = new AnimatableObject("TestObject");
              var property1 = new AnimatableProperty<float> { Value = 123.45f };
              testObject.Properties.Add("Property1", property1);

              var blendGroup = new BlendGroup
              {
            new SingleFromToByAnimation { From = 0, To = 100, TargetProperty = "Property1" },
            new TimelineGroup { new SingleFromToByAnimation { From = 100, To = 300, Duration = TimeSpan.FromSeconds(2.0), TargetProperty = "Property1" }, },
              };
              blendGroup.SynchronizeDurations();
              Assert.AreEqual(TimeSpan.FromSeconds(1.5), blendGroup.GetTotalDuration());

              var manager = new AnimationManager();
              var controller = manager.StartAnimation(blendGroup, testObject);
              controller.UpdateAndApply();
              Assert.AreEqual(50.0f, property1.Value);

              manager.Update(TimeSpan.FromSeconds(0.75));      // t = 0.75
              manager.ApplyAnimations();
              Assert.AreEqual(TimeSpan.FromSeconds(1.5), blendGroup.GetTotalDuration());
              Assert.AreEqual(0.5f * 50.0f + 0.5f * 200.0f, property1.Value);

              blendGroup.SetWeight(0, 0);
              Assert.AreEqual(TimeSpan.FromSeconds(2.0), blendGroup.GetTotalDuration());
              manager.Update(TimeSpan.FromSeconds(0.25));       // t = 1.0
              manager.ApplyAnimations();
              Assert.AreEqual(200.0f, property1.Value);

              blendGroup.SetWeight(0, 10);
              blendGroup.SetWeight(1, 0);
              Assert.AreEqual(TimeSpan.FromSeconds(1.0), blendGroup.GetTotalDuration());
              manager.Update(TimeSpan.Zero);       // t = 1.0
              manager.ApplyAnimations();
              Assert.AreEqual(100.0f, property1.Value);

              blendGroup.SetWeight(0, 10);
              blendGroup.SetWeight(1, 1);
              Assert.AreEqual(new TimeSpan((long)((1.0f * 10.0f / 11.0f + 2.0f * 1.0f / 11.0f) * TimeSpan.TicksPerSecond)), blendGroup.GetTotalDuration());
              manager.Update(TimeSpan.FromSeconds(0.5));       // t = 1.5
              manager.ApplyAnimations();
              Assert.AreEqual(AnimationState.Filling, controller.State);
              Assert.IsTrue(Numeric.AreEqual(100.0f * 10.0f / 11.0f + 300.0f * 1.0f / 11.0f, property1.Value));

              controller.Stop();
              controller.UpdateAndApply();
              Assert.AreEqual(AnimationState.Stopped, controller.State);
              Assert.AreEqual(123.45f, property1.Value);
        }
Exemple #18
0
 /// <inheritdoc/>
 protected override void OnInitialize(AnimationManager animationManager)
 {
     // Start fade-in animation on animation weight.
       var fadeInAnimation = new SingleFromToByAnimation
       {
     From = 0,
     Duration = _fadeInDuration,
     EasingFunction = DefaultEase,
     FillBehavior = FillBehavior.Stop,
       };
       animationManager.StartAnimation(fadeInAnimation, AnimationInstance.WeightProperty);
       animationManager.Add(AnimationInstance, HandoffBehavior.Compose, _previousAnimation);
       animationManager.Remove(this);
 }
Exemple #19
0
        /// <inheritdoc/>
        protected override void OnInitialize(AnimationManager animationManager)
        {
            // Start fade-in animation on animation weight.
              var fadeInAnimation = new SingleFromToByAnimation
              {
            From = 0,
            Duration = _fadeInDuration,
            EasingFunction = DefaultEase,
            FillBehavior = FillBehavior.Stop,
              };
              _fadeInController = animationManager.StartAnimation(fadeInAnimation, AnimationInstance.WeightProperty);

              // Add animation.
              animationManager.Add(AnimationInstance, HandoffBehavior.Compose, null);
        }
Exemple #20
0
        public void AutoRecycleEnabled()
        {
            var manager = new AnimationManager();
              var property = new AnimatableProperty<float>();
              var animation = new SingleFromToByAnimation();
              var controller = manager.CreateController(animation, property);

              controller.Start();
              controller.Stop();
              Assert.IsTrue(controller.IsValid);

              controller.AutoRecycleEnabled = true;

              controller.Start();
              controller.Stop();
              Assert.IsFalse(controller.IsValid);
        }
Exemple #21
0
        public void AdditiveAnimation()
        {
            var property = new AnimatableProperty<float> { Value = 123.4f };
              var manager = new AnimationManager();

              // Start base animation.
              var animation0 = new SingleFromToByAnimation
              {
            Duration = TimeSpan.FromSeconds(1.0),
            To = 234.5f,
            FillBehavior = FillBehavior.Stop,
              };
              var controller0 = manager.StartAnimation(animation0, property);
              Assert.AreEqual(123.4f, property.Value);

              // Start additive animation.
              var animation1 = new SingleFromToByAnimation
              {
            Duration = TimeSpan.FromSeconds(1.0),
            From = 0.0f,
            To = 10.0f,
            IsAdditive = true,
            FillBehavior = FillBehavior.Hold,
              };
              var controller1 = manager.StartAnimation(animation1, property, AnimationTransitions.Compose());
              Assert.AreEqual(123.4f, property.Value);

              manager.Update(TimeSpan.FromSeconds(1.0));
              Assert.AreEqual(123.4f, property.Value);

              manager.ApplyAnimations();
              Assert.AreEqual(234.5f + 10.0f, property.Value);

              manager.Update(new TimeSpan(166666));
              Assert.AreEqual(234.5f + 10.0f, property.Value);

              manager.ApplyAnimations();
              Assert.AreEqual(123.4f + 10.0f, property.Value);

              // Stop additive animation.
              controller1.Stop();
              controller1.UpdateAndApply();
              Assert.AreEqual(123.4f, property.Value);
        }
Exemple #22
0
        /// <summary>
        /// 필드랑 관련없이 유물을 얻는다.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="artifact"></param>
        public static void AddArtifact(this Unit target, Artifact artifact)
        {
            if (Data.AllArtifacts.Contains(artifact))
            {
                artifact = artifact.Clone();
            }

            // 아티펙트의 주인은 target이다.
            artifact.Owner = target;

            // 추가 시점 능력 호출
            artifact.OnAdd();

            // 소지품에 추가
            target.Belongings.Add(artifact);

            // 로그 출력
            AnimationManager.MakeFadeTextClips(target, $"+{artifact.Name}", Color.yellow);
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font        = Content.Load <SpriteFont>("Fonts/LuckiestGuy");


            LoadAndSave loading = new LoadAndSave(allGameObjectList, texturesDictionary);

            //MUSIC
            audioManager.LoadSongsAndSound(this.Content);
            loading.loadEverything(this.Content, ref playerSpriteSheets, ref texturesDictionary, ref enemySpriteSheets);

            levelEditor.loadTextures(Content, ref texturesDictionary, graphics.GraphicsDevice);

            animManager = new AnimationManager(playerSpriteSheets);
            wormPlayer  = new Player(playerSpriteSheets["playerMoveSpriteSheet"], new Vector2(SpriteSheetSizes.spritesSizes["Reggie_Move_X"] / 5, SpriteSheetSizes.spritesSizes["Reggie_Move_Y"] / 5), new Vector2(13444, 1500), (int)Enums.ObjectsID.PLAYER);

            //SHOP
            shopKeeper = new ShopKeeper(texturesDictionary["cornnency"], new Vector2(334, 407), new Vector2(2600, 4225), (int)Enums.ObjectsID.SHOPKEEPER, texturesDictionary); //13494


            enemySpawnList    = new List <Platform>();
            allGameObjectList = new List <GameObject>();
            interactiveObject = new List <GameObject>();
            cornnencyList     = new List <GameObject>();
            levelObjectList   = new List <GameObject>();



            loadAndSave.LoadGameObjects(ref allGameObjectList, ref wormPlayer);
            //allGameObjectList.Add(shopKeeper);

            levelManager = new Levels(ref wormPlayer.gameObjectPosition, ref levelObjectList, ref allGameObjectList);
            levelManager.sortGameObjects();

            loadAndSave = new LoadAndSave(allGameObjectList, texturesDictionary);
            ingameMenus = new IngameMenus(spriteBatch, texturesDictionary, playerSpriteSheets);
            FillLists();
            // MONO: use this.Content to load your game content here
            hakume = new Boss(null, new Vector2(400, 422), new Vector2(-4750, -11450), (int)Enums.ObjectsID.BOSS, enemySpriteSheets);
            hakume.SetPlayer(wormPlayer);
        }
    void Start()
    {
        if (StageCobtroller.stageNum == 1 && StageCobtroller.Shooting == false)
        {
            TutorialFlg.TutorialReSet();
            StageCobtroller.Technique = new int[3] {
                0, -1, -1
            };
        }
        countinage       = countObjct.GetComponent <Image>();
        enemyTurn        = Random.Range(2, 5);
        gaged            = gageobj.GetComponent <Image>();
        animationManager = animeCon.GetComponent <AnimationManager>();
        text             = textObj.GetComponent <Text>();
        nametext         = nameObj.GetComponent <Text>();
        padController2   = padControllerObj.GetComponent <PadController2>();
        enj           = EnjObj.GetComponent <Enj>();
        statusManager = StatusManagerObj.GetComponent <StatusManager>();
        shooting      = shootingObj.GetComponent <ShootingEnj>();
        startPas      = 0;

        gameMode           = 22;
        summonTutorialTime = 0;

        AudioManager.Instance.PlayBGM(AudioManager.BgmName.ThemeBGM);


        switch (StageCobtroller.stageNum)
        {
        case 1:
            Ename = "魚座";
            break;

        case 2:
            Ename = "蟹座";
            break;

        case 3:
            Ename = "蛇使い座";
            startText.GetComponent <Text>().fontSize = 64;
            break;
        }
    }
        public AnimationEngine(Game BaseGame, string Data, string ActorName)
        {
            _Game      = BaseGame;
            _ActorName = ActorName;
            foreach (var x in _Game.Components)
            {
                if (x is TextureManager)
                {
                    _TextureManager = (TextureManager)x;
                }
                else if (x is AnimationManager)
                {
                    _AnimationManagerRef = (AnimationManager)x;
                }
            }

            // Try and Load the Data
            _AnimationManagerRef.LoadData(Data, ActorName);
        }
Exemple #26
0
        public static Vector2Int MoveObject(Vector2Int v)
        {
            // 모든 유닛들
            foreach (Unit unit in BattleManager.instance.AllUnits)
            {
                // unitPosition이 v와 같은애 찾음
                if (unit.Position == v)
                {
                    Vector3 w = new Vector3(v.x, v.y);

                    Sequence sequence = DOTween.Sequence();
                    sequence.Append(UnitObjects[unit].transform.DOMove(w, GameManager.AnimationDelaySpeed / 5).SetEase(Ease.OutCubic));

                    AnimationManager.Reserve(sequence);
                    return(v);
                }
            }
            return(v);
        }
Exemple #27
0
        public override void Update(GameTime gameTime)
        {
            if (AnimationManager != null)
            {
                SetAnimations();
                AnimationManager.Update(gameTime);
            }
            SetSoundInstances();

            Actions(gameTime);

            _timer += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (_timer > 1337f)
            {
                _timer = 0f;
            }

            ResetEnemyAI();
        }
        public void Initialize(string imagefn, Vector2 pos)
        {
            base.Initialize(_gameplayScreen.ScreenManager.Game.Content);
            IsAnimated = true;
            Position   = pos;

            barberPoleSheet     = _gameplayScreen.ScreenManager.spriteSheetLoader.Load(imagefn);
            animationBarberPole =
                new Animation(
                    new Vector2(0, 0),
                    TimeSpan.FromSeconds(5f / 30f), SpriteEffects.None, barberPoleSprites);

            var barberPoleAnimations = new[]
            {
                animationBarberPole
            };

            barberPoleAnimationManager = new AnimationManager(barberPoleSheet, Position, barberPoleAnimations);
        }
Exemple #29
0
        /// <summary>
        /// Initializes a new instance of the class <see cref="MixedRealityExtensionApp"/>
        /// </summary>
        /// <param name="globalAppId">The global id of the app.</param>
        /// <param name="ownerScript">The owner mono behaviour script for the app.</param>
        internal MixedRealityExtensionApp(string globalAppId, MonoBehaviour ownerScript, IMRELogger logger = null)
        {
            GlobalAppId   = globalAppId;
            _ownerScript  = ownerScript;
            EventManager  = new MWEventManager(this);
            _assetLoader  = new AssetLoader(ownerScript, this);
            _userManager  = new UserManager(this);
            _actorManager = new ActorManager(this);

            UsePhysicsBridge = Constants.UsePhysicsBridge;

            if (UsePhysicsBridge)
            {
                _physicsBridge = new PhysicsBridge();
            }

            SoundManager     = new SoundManager(this);
            AnimationManager = new AnimationManager(this);
            _commandManager  = new CommandManager(new Dictionary <Type, ICommandHandlerContext>()
            {
                { typeof(MixedRealityExtensionApp), this },
                { typeof(Actor), null },
                { typeof(AssetLoader), _assetLoader },
                { typeof(ActorManager), _actorManager },
                { typeof(AnimationManager), AnimationManager }
            });

            var cacheRoot = new GameObject("MRE Cache");

            cacheRoot.transform.SetParent(_ownerScript.gameObject.transform);
            cacheRoot.SetActive(false);
            _assetManager = new AssetManager(this, cacheRoot);

            RPC         = new RPCInterface(this);
            RPCChannels = new RPCChannelInterface();
            // RPC messages without a ChannelName will route to the "global" RPC handlers.
            RPCChannels.SetChannelHandler(null, RPC);
#if ANDROID_DEBUG
            Logger = logger ?? new UnityLogger(this);
#else
            Logger = logger ?? new ConsoleLogger(this);
#endif
        }
Exemple #30
0
    void Start()
    {
        if (!GameManager.isLevelingUp)        //Game Launch, run one time in life time of the game.
        {
            GameManager.Instance.Initialise(singleColliderPrefab, twinColliderPrefab);
            GameManager.Instance.InitLevel(-2560, (Screen.height / 2) - 120, 2560, (Screen.height / -2) + 50);
            GameManager.colorPallette = colorPallette;
            GameManager.audios        = audios;
            menuPanel.SetActive(true);
            UIPanel.SetActive(false);
            miniMapCam.enabled = false;
            hasGameStarted     = false;
        }
        //load level specific data
        GetLevelSettings();
        //animation manager handles all graphics and animation
        animationManager = new AnimationManager(scrollSpeedMax, enemiesToSpawn, enemiesAtATime);
        //pool the explosion effect
        animationManager.PreparePixelExplosion();
        //add defender and bg
        animationManager.AddDefender();
        animationManager.AddBackground(scrollingMaterial);

        isMouseDown = false;

        //listen to async events
        NotificationCenter.DefaultCenter.AddObserver(this, "BulletHitAlert");
        NotificationCenter.DefaultCenter.AddObserver(this, "HitAlert");
        NotificationCenter.DefaultCenter.AddObserver(this, "ProximityAlert");
        NotificationCenter.DefaultCenter.AddObserver(this, "NonProximityAlert");
        NotificationCenter.DefaultCenter.AddObserver(this, "LifeLoss");
        NotificationCenter.DefaultCenter.AddObserver(this, "EnemyKilled");

        if (GameManager.isLevelingUp)
        {
            updateUI();
            //launch the initial number of enemies
            LaunchEnemies(enemiesAtATime);
            GameManager.isLevelingUp = false;
            hasGameStarted           = true;
        }
    }
Exemple #31
0
 public MaterialSingleLineTextField()
 {
     base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer, true);
     this._animationManager = new AnimationManager(true)
     {
         Increment          = 0.06,
         AnimationType      = AnimationType.EaseInOut,
         InterruptAnimation = false
     };
     this._animationManager.OnAnimationProgress += delegate
     {
         base.Invalidate();
     };
     this._baseTextBox = new BaseTextBox
     {
         BorderStyle = BorderStyle.None,
         Font        = this.SkinManager.ROBOTO_REGULAR_11,
         ForeColor   = this.SkinManager.GetPrimaryTextColor(),
         Location    = new Point(0, 0),
         Width       = base.Width,
         Height      = base.Height - 5
     };
     if (!base.Controls.Contains(this._baseTextBox) && !base.DesignMode)
     {
         base.Controls.Add(this._baseTextBox);
     }
     this._baseTextBox.GotFocus += delegate
     {
         this._animationManager.StartNewAnimation(AnimationDirection.In, null);
     };
     this._baseTextBox.LostFocus += delegate
     {
         this._animationManager.StartNewAnimation(AnimationDirection.Out, null);
     };
     base.BackColorChanged += delegate
     {
         this._baseTextBox.BackColor = this.BackColor;
         this._baseTextBox.ForeColor = this.SkinManager.GetPrimaryTextColor();
     };
     this._baseTextBox.TabStop = true;
     base.TabStop = false;
 }
        public MaterialSingleLineTextField()
        {
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer, true);

            _animationManager = new AnimationManager
            {
                Increment          = 0.06,
                AnimationType      = AnimationType.EaseInOut,
                InterruptAnimation = false
            };
            _animationManager.OnAnimationProgress += sender => Invalidate();

            _baseTextBox = new BaseTextBox
            {
                BorderStyle = BorderStyle.None,
                Font        = SkinManager.NazanintarRegular11,
                ForeColor   = SkinManager.GetPrimaryTextColor(),
                Location    = new Point(0, 0),
                Width       = Width,
                Height      = Height - 5
            };

            if (!Controls.Contains(_baseTextBox) && !DesignMode)
            {
                Controls.Add(_baseTextBox);
            }

            _baseTextBox.GotFocus  += (sender, args) => _animationManager.StartNewAnimation(AnimationDirection.In);
            _baseTextBox.LostFocus += (sender, args) => _animationManager.StartNewAnimation(AnimationDirection.Out);
            _baseTextBox.KeyDown   += (sender, args) => _baseKeyDown(args);
            _baseTextBox.KeyUp     += (sender, args) => _baseKeyUp(args);
            _baseTextBox.KeyPress  += (sender, args) => _baseKeyPress(args);
            BackColorChanged       += (sender, args) =>
            {
                _baseTextBox.BackColor = BackColor;
                _baseTextBox.ForeColor = SkinManager.GetPrimaryTextColor();
            };

            //Fix for tabstop
            _baseTextBox.TabStop = true;
            TabStop = false;
        }
Exemple #33
0
        public override void Update(GameTime gameTime)
        {
            IFramesTimer   += gameTime.ElapsedGameTime.TotalSeconds;
            WalkSoundTimer += gameTime.ElapsedGameTime.TotalSeconds;
            WindDownSoundIntervallTimer += gameTime.ElapsedGameTime.TotalSeconds;

            if (IsStandingStill & !IsInAir && !IsJumping)
            {
                AnimationManager.Play(Animations["standing"]);
            }

            PreviousKeyboard = CurrentKeyboard;
            CurrentKeyboard  = Keyboard.GetState();

            if (AliveTimer > 0 && !IsWindingUp)
            {
                AliveTimer -= AliveDrain;
            }

            if (IsInAir)
            {
                IsOnConveyor = false;
            }

            Windup(gameTime);
            FallDown();
            Move();
            MoveParticle();
            PlayWindDownSoundEffect();

            Position += Speed;
            if (IsOnConveyor)
            {
                Position = new Vector2(Position.X - ConveyorSpeed, Position.Y);
            }

            if (WindUpAnimationManager.IsPlaying)
            {
                WindUpAnimationManager.Update(gameTime);
            }
            base.Update(gameTime);
        }
Exemple #34
0
        public void AnimateProperty()
        {
            var testObject = new TestObject {
                Value = 10.0f
            };
            Func <float>   getter   = () => testObject.Value;
            Action <float> setter   = f => { testObject.Value = f; };
            var            property = new DelegateAnimatableProperty <float>(null, null);

            var animation = new SingleFromToByAnimation
            {
                From       = 100,
                To         = 200,
                Duration   = TimeSpan.FromSeconds(1.0),
                IsAdditive = true,
            };

            var manager    = new AnimationManager();
            var controller = manager.StartAnimation(animation, property);

            manager.Update(TimeSpan.FromSeconds(0.5));
            manager.ApplyAnimations();

            property.GetValue = getter;
            property.SetValue = setter;

            manager.ApplyAnimations();

            Assert.AreEqual(150.0f, testObject.Value);
            Assert.IsTrue(((IAnimatableProperty)property).IsAnimated);

            manager.Update(TimeSpan.FromSeconds(0.5));
            manager.ApplyAnimations();

            Assert.AreEqual(200.0f, testObject.Value);
            Assert.IsTrue(((IAnimatableProperty)property).IsAnimated);

            controller.Stop();
            controller.UpdateAndApply();
            Assert.AreEqual(200.0f, testObject.Value);
            Assert.IsFalse(((IAnimatableProperty)property).IsAnimated);
        }
    public static bool getAnimFrameFirePoint(
        ref int[] result,
        int animID,
        int frameID,
        int firePointIDConst)
    {
        bool flag = false;

        if ((animID & 16384) != 0)
        {
            animID &= -16385;
            flag    = true;
        }
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();
        int num               = firePointIDConst;
        int index1            = (int)animManData.animFrameOffset[animID] + frameID;
        int index2            = animManData.framePrimitiveOffset[index1];
        int frameNumPrimitive = (int)animManData.frameNumPrimitives[index1];

        for (int index3 = 0; index3 != frameNumPrimitive; ++index3)
        {
            int primitiveType = (int)animManData.primitiveData[index2];
            if (primitiveType == 7)
            {
                if (num == 0)
                {
                    result[0] = (int)animManData.primitiveData[index2 + 1];
                    result[1] = (int)animManData.primitiveData[index2 + 2];
                    if (flag)
                    {
                        result[0] = -result[0];
                    }
                    return(true);
                }
                --num;
            }
            index2 += AnimationManager.getNumAttributes(primitiveType);
        }
        result[0] = 0;
        result[1] = 0;
        return(false);
    }
    public static bool getAnimFrameCollisionBox(int[] result, int animID, int frameID, int boxID)
    {
        bool flag = false;

        if ((animID & 16384) != 0)
        {
            animID &= -16385;
            flag    = true;
        }
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();

        if (animID != -1)
        {
            int index1            = (int)animManData.animFrameOffset[animID] + frameID;
            int index2            = animManData.framePrimitiveOffset[index1];
            int frameNumPrimitive = (int)animManData.frameNumPrimitives[index1];
            int num1 = 0;
            for (int index3 = 0; index3 != frameNumPrimitive; ++index3)
            {
                int primitiveType = (int)animManData.primitiveData[index2];
                if (primitiveType == 2)
                {
                    if (num1 == boxID)
                    {
                        result[0] = (int)animManData.primitiveData[index2 + 1];
                        result[1] = (int)animManData.primitiveData[index2 + 2];
                        result[2] = (int)animManData.primitiveData[index2 + 3];
                        result[3] = (int)animManData.primitiveData[index2 + 4];
                        int num2 = flag ? 1 : 0;
                        return(true);
                    }
                    ++num1;
                }
                index2 += AnimationManager.getNumAttributes(primitiveType);
            }
        }
        result[0] = 0;
        result[1] = 0;
        result[2] = 0;
        result[3] = 0;
        return(false);
    }
        public MaterialColorPicker()
        {
            pBaseColor = SkinManager.ColorScheme.AccentColor;
            Width      = 248;
            Height     = 425;

            RedSlider   = new MaterialColorSlider("R", Color.Red, pBaseColor.R);
            GreenSlider = new MaterialColorSlider("G", Color.Green, pBaseColor.G);
            BlueSlider  = new MaterialColorSlider("B", Color.Blue, pBaseColor.B);

            RedSlider.Width   = Width;
            GreenSlider.Width = Width;
            BlueSlider.Width  = Width;

            RedSlider.onValueChanged   += RedSlider_onValueChanged;
            GreenSlider.onValueChanged += GreenSlider_onValueChanged;
            BlueSlider.onValueChanged  += BlueSlider_onValueChanged;

            Controls.Add(RedSlider);
            Controls.Add(GreenSlider);
            Controls.Add(BlueSlider);

            RedSlider.Location   = new Point(0, (int)(Height * 0.61));
            GreenSlider.Location = new Point(0, RedSlider.Location.Y + RedSlider.Height + 5);
            BlueSlider.Location  = new Point(0, GreenSlider.Location.Y + GreenSlider.Height + 5);

            objShadowPath = new GraphicsPath();
            objShadowPath.AddLine(0, (int)(Height * 0.6), Width, (int)(Height * 0.6));

            HoveredIndex = -1;
            initColorHints();

            DoubleBuffered = true;

            objAnimationManager = new AnimationManager()
            {
                Increment     = 0.03,
                AnimationType = AnimationType.EaseInOut
            };
            objAnimationManager.OnAnimationProgress += sender => Invalidate();
            objAnimationManager.OnAnimationFinished += objAnimationManager_OnAnimationFinished;
        }
        public void StartStopAnimationsWithinOneFrame1()
        {
            var property = new AnimatableProperty <float> {
                Value = 123.4f
            };
            var manager = new AnimationManager();

            // Start base animation.
            var animation0 = new SingleFromToByAnimation
            {
                Duration     = TimeSpan.Zero,
                To           = 234.5f,
                FillBehavior = FillBehavior.Stop,
            };
            var controller0 = manager.StartAnimation(animation0, property);

            controller0.UpdateAndApply();
            Assert.AreEqual(234.5f, property.Value);

            // Start additive animation.
            var animation1 = new SingleFromToByAnimation
            {
                Duration     = TimeSpan.Zero,
                To           = 10.0f,
                IsAdditive   = true,
                FillBehavior = FillBehavior.Stop,
            };
            var controller1 = manager.StartAnimation(animation1, property, AnimationTransitions.Compose());

            controller1.UpdateAndApply();
            Assert.AreEqual(234.5f + 10.0f, property.Value);

            // Stop base animation.
            controller0.Stop();
            controller0.UpdateAndApply();
            Assert.AreEqual(123.4f + 10.0f, property.Value);

            // Stop additive animation.
            controller1.Stop();
            controller1.UpdateAndApply();
            Assert.AreEqual(123.4f, property.Value);
        }
Exemple #39
0
        public override IEnumerator Use(Vector2Int target)
        {
            // 스킬 소모 기록
            User.IsMoved = true;
            WaitingTime  = ReuseTime;

            if (target == User.Position)
            {
                yield break;
            }

            Vector2Int startPosition = User.Position;
            // 1 단계 : 위치 이동
            List <Vector2Int> path = Common.PathFind.PathFindAlgorithm(User, User.Position, target);

            // 갈수 있는 길이 없다면??
            if (path == null)
            {
                Debug.LogError($"{User.Position}에서 {target}으로 길이 존재하지 않습니다.");
                yield break;
            }

            User.animationState = Unit.AnimationState.Move;
            float moveTime = GameManager.AnimationDelaySpeed / 5;

            for (int i = 1; i < path.Count; i++)
            {
                // 유닛 포지션의 변경은 여러번 일어난다.
                User.Position = path[i];
                AnimationManager.MakeAnimationClips("Dust", path[i - 1]);
                if (User.Alliance != UnitAlliance.Party)
                {
                    ScreenTouchManager.instance.CameraMove(path[i]);
                }
                yield return(new WaitForSeconds(moveTime));
            }
            User.animationState = Unit.AnimationState.Idle;

            Debug.Log($"{User.Name}가 {Name}스킬을 {AITarget}타겟을 {Priority}우선으로 {target}에 사용!");
            // 실제 타일에 상속되는건 한번이다.
            Common.Command.Move(User, startPosition, target);
        }
Exemple #40
0
        public Sprite(Dictionary <string, Animation> animations)
        {
            _texture = null;

            Children = new List <Sprite>();

            Colour = Color.White;

            TextureData = null;

            _animations = animations;

            Animation animation = _animations.FirstOrDefault().Value;

            _animationManager = new AnimationManager(animation);

            Origin = new Vector2(animation.FrameWidth / 2, animation.FrameHeight / 2);

            ShowRectangle = false;
        }
    public static int getAnimFrameFirePointCount(int animID, int frameID)
    {
        animID &= -16385;
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();
        int index1            = (int)animManData.animFrameOffset[animID] + frameID;
        int index2            = animManData.framePrimitiveOffset[index1];
        int frameNumPrimitive = (int)animManData.frameNumPrimitives[index1];
        int num = 0;

        for (int index3 = 0; index3 != frameNumPrimitive; ++index3)
        {
            int primitiveType = (int)animManData.primitiveData[index2];
            if (primitiveType == 7)
            {
                ++num;
            }
            index2 += AnimationManager.getNumAttributes(primitiveType);
        }
        return(num);
    }
    public static bool loadImage(
        AnimationManagerData thisData,
        ResourceManager resourceManager,
        int resID)
    {
        int imageIndex = AnimationManager.getImageIndex(resID);

        if (imageIndex == 0)
        {
            return(false);
        }
        int index = 0;

        if (thisData.m_animImageArray[index][imageIndex] == null)
        {
            Image image = ResourceManager.loadImage(resID);
            thisData.m_animImageArray[index][imageIndex] = image;
        }
        return(true);
    }
Exemple #43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MaterialFlatButton"/> class.
        /// </summary>
        public MaterialFlatButton()
        {
            Primary = false;

            _animationManager = new AnimationManager(false)
            {
                Increment     = 0.03,
                AnimationType = AnimationType.EaseOut
            };
            _hoverAnimationManager = new AnimationManager
            {
                Increment     = 0.07,
                AnimationType = AnimationType.Linear
            };
            _hoverAnimationManager.OnAnimationProgress += sender => Invalidate();
            _animationManager.OnAnimationProgress      += sender => Invalidate();
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
            Margin       = new Padding(4, 6, 4, 6);
            Padding      = new Padding(0);
        }
Exemple #44
0
        public BasicItemInformation()
        {
            this.name             = "";
            this.description      = "";
            this.categoryName     = "";
            this.categoryColor    = new Color(0, 0, 0);
            this.price            = 0;
            this.TileLocation     = Vector2.Zero;
            this.edibility        = -300;
            this.canBeSetIndoors  = false;
            this.canBeSetOutdoors = false;

            this.animationManager = new AnimationManager();
            this.drawPosition     = Vector2.Zero;
            this.drawColor        = Color.White;
            this.inventory        = new InventoryManager();
            this.lightManager     = new LightManager();

            this.facingDirection = Enums.Direction.Down;
        }
Exemple #45
0
 void Start()
 {
     m_ForTransformObj = new GameObject("");
     m_ForTransformObj.transform.position = Vector3.zero;
     m_ForTransformObj.transform.rotation = Quaternion.identity;
     m_AnimationPlayer = gameObject.GetComponentInChildren <AnimationManager>();
     if (null == m_AnimationPlayer)
     {
         m_AnimationPlayer = gameObject.GetComponent <AnimationManager>();
         if (null == m_AnimationPlayer)
         {
             Debug.LogError("GameObject has no AnimationPlayer");
         }
     }
     m_CharacterController = gameObject.GetComponent <CharacterController>();
     if (null == m_CharacterController)
     {
         Debug.LogError(this.name + " don't have CharacterController");
     }
 }
Exemple #46
0
        public override void Update(GameTime gameTime)
        {
            if (AnimationManager != null)
            {
                SetAnimations();
                AnimationManager.Update(gameTime);
            }

            ManageHealth(gameTime);

            _onGround = false;

            _timer += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (_timer > 1337f)
            {
                _timer = 0f;
            }

            ResetEnemyAI();
        }
Exemple #47
0
        public void Init()
        {
            timer          = new System.Windows.Forms.Timer();
            timer.Interval = 10000;
            timer.Start();

            animationThread = new Thread(() =>
            {
                while (true)
                {
                    AnimationManager.Update();
                    Thread.Sleep((int)(1000.0f / ANIMATION_UPDATES));
                    if (AnimationManager.animations.Count != 0)
                    {
                        shouldUpdate = true;
                    }
                }
            });
            animationThread.Start();
        }
Exemple #48
0
    public void InitializeData()
    {
        hpCon      = gameObject.transform.GetChild(1).gameObject.GetComponent <HealthbarController>();
        plrChar    = gameObject.transform.GetChild(0).gameObject;
        sword      = plrChar.transform.GetChild(0).gameObject;
        attcon     = sword.transform.GetChild(0).GetComponent <AttackControllerPlr>();
        spawner    = GameObject.FindGameObjectWithTag("Assets").GetComponent <Spawner>();
        anim       = gameObject.transform.GetChild(0).gameObject.GetComponent <AnimationManager>();
        pinfo.name = DataTransferManager.dataHolder.name;
        pinfo      = new PlayerInfo(1, hpCon);
        pinfo.SetStartingStats();

        RefreshPosAsInt(new Vector2Int(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y)));
        MapDataController.map[pos.x, pos.y].SetNpc(pinfo);
        SetABC_ToAbilities(); //reference to action button group, for easier communication between buttons and abilities
        pinfo.dir = "";

        abc.pinfo = pinfo;
        acp.SetTimer();
    }
Exemple #49
0
        public void Render(ref RenderWindow renderWindow)
        {
            DeltaTime = clock.Restart().AsSeconds();

            renderWindow.Clear(Color.White);
            //FPS
            FPSText.DisplayedString = (1f / DeltaTime).ToString("00");
            renderWindow.Draw(FPSText);

            AnimationManager.UpdateAll();

            foreach (var obj in Children)
            {
                obj.Draw(ref renderWindow);
            }

            OnDraw?.Invoke(ref renderWindow);

            renderWindow.Display();
        }
Exemple #50
0
 public Enemy(Dictionary <string, Animation> animations, float scale, Vector2 position, Vector2 baseVelocity, int fromx, int tox, bool isShooting, int rangeOfSight)
 {
     _animations       = animations;
     _animationManager = new AnimationManager(_animations.First().Value);
     this.scale        = scale;
     if (position.X > fromx && position.X < tox)
     {
         this.position = position;
     }
     else
     {
         this.position = new Vector2((fromx + tox) / 2, position.Y);
     }
     this.fromx        = fromx;
     this.tox          = tox;
     this.baseVelocity = baseVelocity;
     this.isShooting   = isShooting;
     this.rangeOfSight = rangeOfSight;
     velocity          = baseVelocity;
 }
Exemple #51
0
    protected override void OnCollisionEnter2D(Collision2D collision)
    {
        if (state == State.FLY)
        {
            base.OnCollisionEnter2D(collision);

            var ir = collision?.collider?.gameObject.GetComponent <InputRouter>();
            if (ir != null && ir?.PlayerId != PlayerId)
            {
                Debug.Log("HOOKED " + name + "-" + collision.collider.gameObject.name + " C");
                state                     = State.DRAG;
                targetTransform           = collision.collider.transform;
                targetBody                = collision.collider.gameObject.GetComponent <Rigidbody2D>();
                animationManager          = collision.collider.gameObject.GetComponent <AnimationManager>();
                animationManager.Handicap = "ledge";
                body.velocity             = Vector2.zero;
                pxLine.gameObject.SetActive(true);
            }
        }
    }
Exemple #52
0
        public void AnimateProperty()
        {
            var testObject = new TestObject { Value = 10.0f };
              Func<float> getter = () => testObject.Value;
              Action<float> setter = f => { testObject.Value = f; };
              var property = new DelegateAnimatableProperty<float>(null, null);

              var animation = new SingleFromToByAnimation
              {
            From = 100,
            To = 200,
            Duration = TimeSpan.FromSeconds(1.0),
            IsAdditive = true,
              };

              var manager = new AnimationManager();
              var controller = manager.StartAnimation(animation, property);

              manager.Update(TimeSpan.FromSeconds(0.5));
              manager.ApplyAnimations();

              property.GetValue = getter;
              property.SetValue = setter;

              manager.ApplyAnimations();

              Assert.AreEqual(150.0f, testObject.Value);
              Assert.IsTrue(((IAnimatableProperty)property).IsAnimated);

              manager.Update(TimeSpan.FromSeconds(0.5));
              manager.ApplyAnimations();

              Assert.AreEqual(200.0f, testObject.Value);
              Assert.IsTrue(((IAnimatableProperty)property).IsAnimated);

              controller.Stop();
              controller.UpdateAndApply();
              Assert.AreEqual(200.0f, testObject.Value);
              Assert.IsFalse(((IAnimatableProperty)property).IsAnimated);
        }
Exemple #53
0
        protected override void Initialize()
        {
            // ----- Initialize Services.
              // The services are stored in Game.Services to make them accessible for all
              // game components.

              // Add the input service, which manages device input, button presses, etc.
              _inputManager = new InputManager(false);
              Services.AddService(typeof(IInputService), _inputManager);

              // Add the animation service.
              _animationManager = new AnimationManager();
              Services.AddService(typeof(IAnimationService), _animationManager);

              // ----- Add GameComponents
              // Initialize the sample factory methods. All samples must be added to this array
              // to be shown.
              _createSampleDelegates = new Func<Sample>[]
              {
            () => new BasicAnimationSample(this),
            () => new CompositeAnimationSample(this),
            () => new PathAnimationSample(this),
            () => new EasingSample(this),
            () => new CustomAnimationSample(this),
            () => new CrossFadeSample(this),
            () => new AnimatableObjectSample(this),
            () => new BlendedAnimationSample(this),
            () => new AdditiveAnimationSample(this),
            () => new DoubleAnimationSample(this),
            () => new StringAnimationSample(this),
              };

              // Start the first sample in the array.
              _activeSampleIndex = 0;
              _activeSample = _createSampleDelegates[0]();
              Components.Add(_activeSample);

              base.Initialize();
        }
Exemple #54
0
        public void ComposeAfter()
        {
            var property = new AnimatableProperty<float> { Value = 100.0f };
              var animationA = new SingleFromToByAnimation
              {
            Duration = TimeSpan.Zero,
            To = 200.0f,
              };

              var manager = new AnimationManager();

              var controllerA = manager.CreateController(animationA, property);
              Assert.AreEqual(100.0f, property.Value);

              controllerA.Start(AnimationTransitions.Compose());
              controllerA.UpdateAndApply();
              Assert.AreEqual(200.0f, property.Value);

              var animationB = new SingleFromToByAnimation
              {
            Duration = TimeSpan.Zero,
            By = 10.0f,
              };

              var controllerB = manager.CreateController(animationB, property);
              Assert.AreEqual(200.0f, property.Value);

              controllerB.Start(AnimationTransitions.Compose(controllerB.AnimationInstance));
              controllerB.UpdateAndApply();
              Assert.AreEqual(210.0f, property.Value);

              controllerA.Stop();
              controllerA.UpdateAndApply();
              Assert.AreEqual(110.0f, property.Value);

              controllerB.Stop();
              controllerB.UpdateAndApply();
              Assert.AreEqual(100.0f, property.Value);
        }
	protected virtual void Start ()
	{
		Animation animation = GetComponentInChildren<Animation> ();
		animationManager = new AnimationManager(animation);
	}
    /// <summary>
    /// Use this for initialization
    /// </summary>
    public void Start()
    {
        gameObject.AddComponent<TouchController>();
        screenManagerRef = gameObject.GetComponent<ScreenManager>();
        gameStateManagerRef = gameObject.GetComponent<GameStateManager>();
        screenManagerRef = gameObject.GetComponent<ScreenManager>();
        animationManagerRef = gameObject.GetComponent<AnimationManager>();
        touchController = gameObject.GetComponent<TouchController>();

        keyDownWatch = new Stopwatch();
        idleWatch = new Stopwatch();
        lastReleaseWatch = new Stopwatch();
        lastJustPressedWatch = new Stopwatch();
        moveRight = KeyCode.D;
        moveLeft = KeyCode.A;
        jump = KeyCode.Space;
    }
Exemple #57
0
        /// <summary>
        /// Must be overriden by child classes for their own server specific startup behaviour.
        /// </summary>
        protected override void StartupComponents()
        {
            m_log.Info("[STARTUP]: Beginning startup processing");

            Version = Util.EnhanceVersionInformation();

            m_log.Info("[STARTUP]: Version: " + Version + "\n");

            Console = new Console(this,"Region", this);
            IConfig cnf = m_configSource.Source.Configs["Startup"];
            string loginURI = "http://127.0.0.1:9000/";
            string firstName = string.Empty;
            string lastName = string.Empty;
            string password = string.Empty;
            string startlocation = "";
            bool loadtextures = true;
            bool multipleSims = false;

            if (cnf != null)
            {
                loginURI = cnf.GetString("login_uri", "");
                firstName = cnf.GetString("first_name", "test");
                lastName = cnf.GetString("last_name", "user");
                password = cnf.GetString("pass_word", "nopassword");
                loadtextures = cnf.GetBoolean("load_textures", true);
                MeshSculpties = cnf.GetBoolean("mesh_sculpties", MeshSculpties);
                BackFaceCulling = cnf.GetBoolean("backface_culling", BackFaceCulling);
                AvatarMesh = cnf.GetString("avatar_mesh", AvatarMesh);
                AvatarMaterial = cnf.GetString("avatar_material", AvatarMaterial);
                AvatarScale = cnf.GetFloat("avatar_scale", AvatarScale);
                startlocation = cnf.GetString("start_location", "");
                multipleSims = cnf.GetBoolean("multiple_sims", multipleSims);
                ProcessFoliage = cnf.GetBoolean("process_foliage", ProcessFoliage);
                m_limitFramesPerSecond = cnf.GetBoolean("limitfps", m_limitFramesPerSecond);
            }
            LoadTextures = loadtextures;
            MainConsole.Instance = Console;

            // Initialize LibOMV
            if (NetworkInterface == null) NetworkInterface = new RadegastNetworkModule(RInstance);
            NetworkInterface.MultipleSims = multipleSims;
            NetworkInterface.OnLandUpdate += OnNetworkLandUpdate;
            NetworkInterface.OnConnected += OnNetworkConnected;
            NetworkInterface.OnObjectAdd += OnNetworkObjectAdd;
            NetworkInterface.OnSimulatorConnected += OnNetworkSimulatorConnected;
            NetworkInterface.OnObjectUpdate += OnNetworkObjectUpdate;
            NetworkInterface.OnObjectRemove += OnNetworkObjectRemove;
            NetworkInterface.OnAvatarAdd += OnNetworkAvatarAdd;
            //NetworkInterface.OnChat +=new NetworkChatDelegate(OnNetworkChat);
            //NetworkInterface.OnFriendsListUpdate +=new NetworkFriendsListUpdateDelegate(OnNetworkFriendsListChange);

            //NetworkInterface.Login(loginURI, firstName + " " + lastName, password, startlocation);

            // Startup the GUI
            Renderer = new RaegastRenderer(this,Device);
            Renderer.Startup();

            GUIFont defaultFont = Renderer.GuiEnvironment.GetFont("defaultfont.png");

            skin = Renderer.GuiEnvironment.Skin;
            skin.Font = defaultFont;
            skincolor = skin.GetColor(GuiDefaultColor.Face3D);
            skincolor.A = 255;
            skin.SetColor(GuiDefaultColor.Face3D, skincolor);
            skincolor = skin.GetColor(GuiDefaultColor.Shadow3D);
            skincolor.A = 255;
            skin.SetColor(GuiDefaultColor.Shadow3D, skincolor);
            // Set up event handler for the GUI window events.
            Renderer.Device.OnEvent += new OnEventDelegate(OnDeviceEvent);

            Renderer.Device.Resizeable = true;

            MeshManager = new MeshManager(Renderer.SceneManager.MeshManipulator, Renderer.Device);

            SceneGraph = new VSceneGraph(this);

            // Set up the picker.
            SceneGraph.TrianglePicker = new TrianglePickerMapper(Renderer.SceneManager.CollisionManager);
            SceneGraph.TriangleSelector = Renderer.SceneManager.CreateMetaTriangleSelector();

            // Only create a texture manager if the user configuration option is enabled for downloading textures
            if (LoadTextures)
            {
                TextureManager = new TextureManager(this,Renderer.Device, Renderer.Driver, SceneGraph.TrianglePicker, SceneGraph.TriangleSelector, "IdealistCache", NetworkInterface);
                TextureManager.OnTextureLoaded += OnNetworkTextureDownloaded;
            }

            AvatarController = new AvatarController(NetworkInterface, null);

            TerrainManager = ModuleManager.GetTerrainManager(this, m_configSource);

            Renderer.SceneManager.SetAmbientLight(new Colorf(1f, 0.2f, 0.2f, 0.2f));

            // This light simulates the sun
            //SceneNode light2 = Renderer.SceneManager.AddLightSceneNode(Renderer.SceneManager.RootSceneNode, new Vector3D(0, 255, 0), new Colorf(0f, 0.5f, 0.5f, 0.5f), 250, -1);
            SceneNode light2 = Renderer.SceneManager.AddLightSceneNode(Renderer.SceneManager.RootSceneNode, new Vector3D(0, 255, 0), new Colorf(0f, 0.6f, 0.6f, 0.6f), 512, -1);

            // Fog is on by default, this line disables it.
            //Renderer.SceneManager.VideoDriver.SetFog(new Color(0, 255, 255, 255), false, 9999, 9999, 0, false, false);
            float fogBrightness = 0.8f;
            Renderer.SceneManager.VideoDriver.SetFog(new Color(0, (int)(0.5f * 255 * fogBrightness), (int)(0.5f * 255 * fogBrightness), (int)(1.0f * 255 * fogBrightness)), true, 50, 100, 0, true, true);

            //ATMOSkySceneNode skynode = new ATMOSkySceneNode(Renderer.Driver.GetTexture("irrlicht2_up.jpg"), null, Renderer.SceneManager, 100, -1);
            
            //ATMOSphere atmosphere = new ATMOSphere(Renderer.Device.Timer, null, Renderer.SceneManager, -1);
            //atmosphere.SkyTexture = Renderer.Driver.GetTexture("irrlicht2_up.jpg");

            
            Renderer.Driver.SetTextureFlag(TextureCreationFlag.CreateMipMaps, false);
            bool Broken = false;
            if (!Broken) Renderer.SceneManager.AddSkyBoxSceneNode(null, new Texture[] {
                Renderer.Driver.GetTexture("topax2.jpg"),
                Renderer.Driver.GetTexture("irrlicht2_dn.jpg"),
                Renderer.Driver.GetTexture("rightax2.jpg"),
				Renderer.Driver.GetTexture("leftax2.jpg"),
                Renderer.Driver.GetTexture("frontax2.jpg"),
                Renderer.Driver.GetTexture("backax2.jpg")}, 
0);

            Renderer.Driver.SetTextureFlag(TextureCreationFlag.CreateMipMaps, true);
            

            CameraController = new CameraController(this,Renderer.SceneManager);

            SceneGraph.WaterNode = new WaterSceneNode(null, Renderer.SceneManager, new Dimension2Df(180, 180), new Dimension2D(100, 100), new Dimension2D(512, 512));
            SceneGraph.WaterNode.Position = new Vector3D(0, 30, 0);
            //SceneGraph.WaterNode.WaveHeight *= .4f;
            SceneGraph.WaterNode.RefractionFactor = 0.3f;
            SceneGraph.WaterNode.WaveDisplacement = 2f;
            SceneGraph.WaterNode.WaveHeight = 2f;
            SceneGraph.WaterNode.WaveLength = 2f;
            SceneGraph.WaterNode.WaveSpeed = 5f;
            SceneGraph.WaterNode.WaveRepetition = 20f;
            SceneGraph.WaterNode.Scale = new Vector3D(0.2f,0.2f,0.2f);
            SceneGraph.WaterNode.MultiColor = new Colorf(0.9f, 0.7f, 0.7f, 1.0f);

            UserInterface = new UserInterfaceManager(this, Renderer.Driver, Renderer.SceneManager, Renderer.GuiEnvironment, CameraController, AvatarController);
            UserInterface.DefaultFont = defaultFont;
             
            XmlReader xml = Broken? null: XmlReader.Create(new StreamReader("../../../media/About.xml"));
            while (xml != null && xml.Read())
            {
                switch (xml.NodeType)
                {
                    case XmlNodeType.Text:
                        UserInterface.AboutText = xml.ReadContentAsString();
                        break;
                    case XmlNodeType.Element:
                        if (xml.Name.Equals("startUpModel"))
                        {
                        }
                        else if (xml.Name.Equals("messageText"))
                            UserInterface.AboutCaption = xml.GetAttribute("caption");
                        break;
                }
            }

            string formsUiConfigurationOption = m_configSource.Source.Configs["Startup"].GetString("forms", "true");
            if (formsUiConfigurationOption == "true")
            {
                frmCommunications f = new frmCommunications(NetworkInterface);
                f.Visible = true;
                this.m_formsThread = new Thread(delegate() { Application.DoEvents(); Thread.Sleep(50); });
                m_formsThread.Start();
            }

            AnimationManager = new AnimationManager(this);

            TimeSpan timeTaken = DateTime.UtcNow - StartupTime;

            m_log.InfoFormat("[STARTUP]: Startup took {0}m {1}s", timeTaken.Minutes, timeTaken.Seconds);

        }
Exemple #58
0
	private void GetAnimationManager ()
	{
		Animation animation = GetComponentInChildren<Animation> ();
		animationManager = new AnimationManager (animation);
	}
Exemple #59
0
    void Start()
    {
        collisionScript = gameObject.GetComponent<PlatformerCollision>();
        animationScript = gameObject.GetComponent<AnimationManager>();

        accelerationX = MAXVELOCITY / 5;
        decelerationX = -1 * (accelerationX * 1.5f);

        accelerationY = 5;
        gravity = 1 * accelerationY;

        resetPos = gameObject.transform.position;

        width = gameObject.rigidbody2D.renderer.bounds.size.x;
        height = gameObject.rigidbody2D.renderer.bounds.size.y;

        InputManager.Instance.OnKeyLeft += OnKeyLeft;
        InputManager.Instance.OnKeyRight += OnKeyRight;
        InputManager.Instance.OnKeyJump += OnKeyJump;
        InputManager.Instance.OnKeyReset += OnKeyReset;

        InputManager.Instance.ReleaseKeyLeftRight += ReleaseKeyLeftRight;
        InputManager.Instance.ReleaseKeyJump += ReleaseKeyJump;
    }
Exemple #60
0
        private void AddGraphicsService()
        {
            // ----- Storage
            // Create a "virtual file system" for reading game assets.
            var titleStorage = new TitleStorage("Content");
            var assetsStorage = new ZipStorage(titleStorage, "DigitalRune.Editor.Game.zip");
            var digitalRuneStorage = new ZipStorage(titleStorage, "DigitalRune.zip");
            var vfsStorage = new VfsStorage();
            vfsStorage.MountInfos.Add(new VfsMountInfo(titleStorage, null));
            vfsStorage.MountInfos.Add(new VfsMountInfo(assetsStorage, null));
            vfsStorage.MountInfos.Add(new VfsMountInfo(digitalRuneStorage, null));

            // ----- Content
            _contentManager = new StorageContentManager(Editor.Services, vfsStorage);
            //_contentManager = new ContentManager(serviceContainer, "Content");
            Editor.Services.Register(typeof(ContentManager), null, _contentManager);

            // ----- Animations
            _animationManager = new AnimationManager();
            Editor.Services.Register(typeof(IAnimationService), null, _animationManager);

            // ----- Graphics
            // Create Direct3D 11 device.
            var presentationParameters = new PresentationParameters
            {
                BackBufferWidth = 1,
                BackBufferHeight = 1,
                DeviceWindowHandle = IntPtr.Zero
            };
            var graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, presentationParameters);
            Editor.Services.Register(typeof(IGraphicsDeviceService), null, new GraphicsDeviceManager(graphicsDevice));

            // Create and register the graphics manager.
            _graphicsManager = new GraphicsManager(graphicsDevice, _contentManager);
            Editor.Services.Register(typeof(IGraphicsService), null, _graphicsManager);
        }