예제 #1
0
    public void Attack()
    {
        IsAttacking = true;
        Animate.ChangeAnimationState("Attacking", animator, currentDirection);

        PrepareAttackHitboxes(currentDirection);
    }
예제 #2
0
    public override void LoadModel()
    {
        string modelPath = "Resources/" + J_ModelResource.GetData(towerInfo.towerData._modelId)._modelPath;

        towerAsset = GameLoader.Instance.LoadAssetSync(modelPath);
        towerObj   = towerAsset.GameObjectAsset;
        towerObj.transform.position = this.towerInfo.GetPosition();
        //增加点击事件
        AddClickInfo(towerObj, towerInfo.Id);
        //加载塔身图片
        GameObject towerBaseObj = towerObj.transform.Find("ArrowTowerBase").gameObject;

        towerBase = InitSpriteImage(towerBaseObj, towerInfo.towerBase);
        //加载射手1
        GameObject shooterObj1 = towerObj.transform.Find("ArrowShooter1").gameObject;

        shooter1 = InitAnimate(shooterObj1, towerInfo.shooter);
        //加载射手2
        GameObject shooterObj2 = towerObj.transform.Find("ArrowShooter2").gameObject;

        shooter2 = InitAnimate(shooterObj2, towerInfo.shooter);

        bulletPos1 = towerObj.transform.Find("BulletPos1").position;
        bulletPos2 = towerObj.transform.Find("BulletPos2").position;
        //根据塔基座大小增加碰撞盒
        //AddBoxColider(towerObj, towerBase.width, towerBase.height);
    }
예제 #3
0
 public void ComponentSetup()
 {
     RandomDiagDirection();
     animComp     = this.GetComponent <Animate>();
     rb           = this.GetComponent <Rigidbody2D>();
     powerUpSizes = new Vector2(this.GetComponent <BoxCollider2D>().size.x, this.GetComponent <BoxCollider2D>().size.y);
 }
 public pgKnjiga_utisaka()
 {
     InitializeComponent();
     txtIme.GotFocus += (oo, ee) =>
     {
         tastatura         = new TastaturaXAML(txtIme);
         tastatura.Loaded += (o, e) => { Animate.SlideUp(tastatura); };
         tastatura.Show();
     };
     txtIme.LostFocus += (oo, ee) =>
     {
         Animate.SlideDown(tastatura);
     };
     txtKomentar.GotFocus += (oo, ee) =>
     {
         tastatura         = new TastaturaXAML(txtKomentar);
         tastatura.Loaded += (o, e) => { Animate.SlideUp(tastatura); };
         tastatura.Show();
     };
     txtKomentar.LostFocus += (oo, ee) =>
     {
         Animate.SlideDown(tastatura);
     };
     Animate.SlideUp(this);
     Animate.GridAnimateEntrance(gdKu);
     Animate.GridAnimateEntrance(gdtmp);
 }
예제 #5
0
 public override void LoadModel()
 {
     towerAsset = GameLoader.Instance.LoadAssetSync("Resources/Prefabs/MageTower.prefab");
     towerObj   = towerAsset.GameObjectAsset;
     towerObj.transform.position = this.towerInfo.GetPosition();
     if (towerObj.GetComponent <ClickInfo>() == null)
     {
         ClickInfo clickInfo = towerObj.AddComponent <ClickInfo>();
         clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
     }
     else
     {
         ClickInfo clickInfo = towerObj.GetComponent <ClickInfo>();
         clickInfo.OnInit(ClickType.Tower, this.towerInfo.Id, FingerDown);
     }
     //加载塔身图片
     if (towerObj.GetComponent <Animate>() != null)
     {
         towerBase = towerObj.GetComponent <Animate>();
     }
     else
     {
         towerBase = towerObj.AddComponent <Animate>();
     }
     towerBase.OnInit(towerInfo.towerBase);
     towerBase.startAnimation("idle");
 }
예제 #6
0
        protected override IEnumerable <Animate> Replace(Level level, Animate obj)
        {
            var reflected      = obj.AsDynamic();
            var levelReflected = level.AsDynamic();

            var treasureChest =
                new TreasureChestEvent(level, new Point(obj.Position.X, obj.Position.Y + YOffset), -1, reflected._objectSpec);

            var trigger = new TriggerAfterLootDrop(level, treasureChest, () =>
            {
                bool hasSpindle = level.GameSave.HasRelic(EInventoryRelicType.TimespinnerSpindle);
                if (hasSpindle)
                {
                    level.GameSave.Inventory.RelicInventory.Inventory.Remove((int)EInventoryRelicType.TimespinnerSpindle);
                }

                ((Queue <ScriptAction>)levelReflected._waitingScripts).Clear();

                reflected._onPickedUpAction();

                if (!hasSpindle)
                {
                    level.GameSave.Inventory.RelicInventory.Inventory.Remove((int)EInventoryRelicType.TimespinnerSpindle);
                }

                var scripts       = ((Queue <ScriptAction>)levelReflected._waitingScripts).ToArray().ToList();
                var giveOrbScript = scripts.Single(s => s.AsDynamic().ScriptType == EScriptType.RelicOrbGetToast);

                giveOrbScript.AsDynamic().ScriptType  = EScriptType.Wait;
                giveOrbScript.AsDynamic().ActionTimer = 0f;
            });

            return(new Animate[] { treasureChest, trigger });
        }
예제 #7
0
 public void PlayAnimation()
 {
     foreach (Animator Animate in ObjectAnimation)
     {
         Animate.SetBool("Idle", false);
     }
 }
예제 #8
0
    static public void MoveToLocal(Transform pObject, Vector3 pDestinationPosition, bool pFadeIn = false, bool pFadeOut = false, float pDuration = -1.0f, Anim_EndAnimCallBack pCallBack = null)
    {
        if (pDuration < 0.0f)
        {
            pDuration = AnimateManager.Instance.defaultMoveToDuration;
        }
        Animate lAnimate = new Animate(pObject); lAnimate.duration = pDuration; lAnimate.endCallBack = pCallBack;

        if (pFadeIn)
        {
            lAnimate.SetFadeIn(); Util.SetActive(pObject, true);
        }
        if (pFadeOut)
        {
            lAnimate.SetFadeOut();
        }
        AnimateManager.Instance.SetOriginalValue_Private(pObject, AnimateType.localTranslation, pObject.localPosition);
        lAnimate.transformCallBack = (float pT, List <Transform> pTransformList) => {
            foreach (Transform lTransform in pTransformList)
            {
                Vector3 lOriginalPosition = AnimateManager.Instance.GetOriginalV3_Private(lTransform, AnimateType.localTranslation);
                lTransform.localPosition = Vector3.Lerp(lOriginalPosition, pDestinationPosition, pT);
            }
        };

        lAnimate.Play();
    }//MoveToLocal
예제 #9
0
 public void StopAnimation()
 {
     foreach (Animator Animate in ObjectAnimation)
     {
         Animate.SetBool("Idle", true);
     }
 }
예제 #10
0
 public void OnAnimateFinished(Animate animate)
 {
     if (animate.code == "Open")
     {
         if (render != null)
         {
             render.sprite = null;
         }
         if (col != null)
         {
             col.enabled = false;
         }
         if (VFX != null)
         {
             VFX.Play();
         }
     }
     if (animate.code == "Close")
     {
         if (VFX != null)
         {
             VFX.Play();
         }
     }
 }
예제 #11
0
    public void Initialize(GhostAIStats stats)
    {
        this.stats = stats;
        stats.self = this;
        NotificationMaster.playerObservers.Add(this);

        float aggro = stats.Aggressiveness();

        if (aggro > 0)
        {
            attack = gameObject.AddComponent <GhostAttack>();
            GetComponent <GhostAttack> ().Initialize(stats);
        }

        movement = gameObject.GetComponent <GhostMovement>();
        movement.Initialize(stats);

        detectionRadius = Room.bounds.extents.x;

        transform.localScale = new Vector3(stats.size, stats.size, 1);

        size = GetComponent <SpriteRenderer>().bounds.extents;

        transform.position     = movement.GetSpawnPosition(size);
        movement.startPosition = transform.position;

        layerMask = 1 << LayerMask.NameToLayer("Wall") | 1 << LayerMask.NameToLayer("Player");

        GetComponent <SpriteRenderer>().sortingOrder = (int)(1.0f / size.magnitude * 1000);

        AdjustColors(aggro);

        animate = GetComponent <Animate>();
        animate.AnimateToColor(Palette.Invisible, color, .3f);
    }
예제 #12
0
 public ActionResult DeleteAnimate()
 {
     try
     {
         Animate c = db.Animates.Find(this.ToModel().Id);
         if (c != null)
         {
             c.IsDeleted    = true;
             c.DeletionDate = DateTime.Now;
             db.SaveChanges();
         }
         return(new HttpStatusCodeResult(HttpStatusCode.OK));
     }
     catch
     {
         LogViewModel l = new LogViewModel
         {
             Id          = Guid.NewGuid(),
             CreatedDate = DateTime.Now,
             Type        = "Deletion",
             Message     = "failed to delete access to database"
         };
         l.AddLog(l);
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
 }
예제 #13
0
    public override void Jump()
    {
        base.Jump();
        // No more jumps left and still not grounded
        if (jumpsLeft <= 0 && !isGrounded)
        {
            return;
        }
        else if (jumpsLeft >= 0 && isGrounded)  // Grounded, so reset jumps
        {
            jumpsLeft = extraJumps + 1;
        }

        if (GetAttackType() == AttackType.FIRE && jumpsLeft == 1)
        {
            myRb2D.velocity = new Vector2(myRb2D.velocity.x, Vector2.up.y + additionSpecialJumpAcceleration);
            Animate.SetTrigger("specialJump");
            Animate.SetBool("isFalling", false);
            SoundManager.instance.PlaySound("NuuttipukkiRocketJump");
            tailJump.SetActive(true);
        }
        else
        {
            SoundManager.instance.PlaySound("NuuttipukkiJump");
        }
        // Jump
        Vector2 tempJump = myRb2D.velocity;

        tempJump.x     *= 0.8f;
        tempJump.y     += Vector2.up.y * jumpAcceleration;
        myRb2D.velocity = tempJump;

        // Reduce number of jumps
        jumpsLeft--;
    }
예제 #14
0
파일: Game.cs 프로젝트: styoe/evo
    void CreateCookie()
    {
        var cookies = GameObject.FindGameObjectsWithTag("Cookie");

        // Destroy the ones out of range
        foreach (var c in cookies)
        {
            if (Vector3.Distance(player.transform.localPosition, c.transform.localPosition) > GameGridRadius || Vector3.Distance(player.transform.localScale, c.transform.localScale) > GameMaxScaleDifference)
            {
                Destroy(c);
            }
        }

        if (cookies.GetLength(0) < maxCookies)
        {
            var playerScale = player.transform.localScale.x;
            var newCookie   = Instantiate(cookie, GetRandomInGameGridRadius(), Quaternion.identity);
            newCookie.name = "Cookie";
            newCookie.tag  = "Cookie";

            float cookieScale = Random.Range(0.3f * playerScale, 3f * playerScale);
            Animate.Scale(newCookie, new Vector3(cookieScale, cookieScale, cookieScale));

            // var cookieSphereCollider = newCookie.gameObject.GetComponent<SphereCollider>();
            // Debug.Log(cookieScale);
            // cookieSphereCollider.radius = cookieScale / 2f;
        }
    }
예제 #15
0
파일: Game.cs 프로젝트: styoe/evo
    void CreatePowerup()
    {
        var powerups = GameObject.FindGameObjectsWithTag("Powerup");

        // Destroy the ones out of range
        foreach (var p in powerups)
        {
            if (Vector3.Distance(player.transform.localPosition, p.transform.localPosition) > GameGridRadius || Vector3.Distance(player.transform.localScale, p.transform.localScale) > GameMaxScaleDifference)
            {
                Destroy(p);
            }
        }

        if (powerups.GetLength(0) < maxPowerups)
        {
            var playerScale = player.transform.localScale.x;
            var newPowerup  = Instantiate(powerup, GetRandomInGameGridRadius(), Quaternion.identity);
            var powerupType = powerupTypes[Random.Range(0, powerupTypes.Length)];
            newPowerup.name = powerupType;
            newPowerup.tag  = "Powerup";
            newPowerup.transform.rotation = new Quaternion(-90, 0, 0, 0);

            var textMesh = newPowerup.GetComponent <TextMesh>();
            textMesh.text = powerupType;

            float powerupScale = Random.Range(0.3f * playerScale, 3f * playerScale);
            Animate.Scale(newPowerup, new Vector3(powerupScale, powerupScale, powerupScale));
        }
    }
예제 #16
0
        public Animate ToModel()
        {
            Animate a = new Animate
            {
                DeletionDate   = this.DeletionDate,
                DeletionUserId = this.DeletionUserId,
                Depth          = this.Depth,
                Height         = this.Height,
                Id             = this.Id,
                ImageId        = this.ImageId,
                Image          = db.Images.Find(this.ImageId),
                IsDeleted      = this.IsDeleted,
                ModifiedDate   = this.ModifiedDate,
                ModifiedUserId = this.ModifiedUserId,
                PosX           = this.PosX,
                PosY           = this.PosY,
                Question       = db.Questions.Find(this.QuestionId),
                QuestionId     = this.QuestionId,
                //TimeEnd = this.TimeEnd,
                //TimeStart = this.TimeStart,
                Width         = this.Width,
                CreatedDate   = this.CreatedDate,
                CreatedUserId = this.CreatedUserId
            };

            return(a);
        }
예제 #17
0
    /// <summary>
    /// Create a new tile of the specified element at position y, x
    /// </summary>
    private static void CreateTile(int y, int x, int element, Transform parent, bool fill = false)
    {
        GameObject go = Instantiate(_tilePrefabs[element], parent);

        go.name = "T " + x + " " + y;

        Transform t = go.transform;

        t.localPosition = new Vector2(
            InitPos + x,
            InitPos + y + (fill ? DropHeight : 0));

        t.GetChild(0).localPosition = Z.VSelectedTileOverlay;
        t.GetChild(1).localPosition = Z.VTileSprite;

        Tile tile = go.AddComponent <Tile>();

        tile.Initialize(go, y, x, (Element)element);
        _tiles[y, x] = tile;

        if (fill)
        {
            // Set the alpha to 0 to prevent spawn flicker
            tile.SpriteTransform.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
            Animate.Fill(tile);
        }
    }
예제 #18
0
 //Varibles End ***************************************************************
 // Use this for initialization
 void Start()
 {
     networkManager = GameObject.Find("NetworkManager");
     getInput = networkManager.GetComponent<GetInput>();
     boardState = networkManager.GetComponent<BoardState>();
     animate = networkManager.GetComponent<Animate>();
 }
예제 #19
0
        static void DrawGizmos(Animate aData, GizmoType gizmoType)
        {
            //check if it's the one opened
            if (TimelineWindow.window != null && TimelineWindow.window.aData != null && TimelineWindow.window.aData.IsDataMatch(aData))
            {
                AnimateEditControl eData = TimelineWindow.AnimEdit(aData);

                List <Take> _t = eData.takes;

                if (_t == null || _t.Count == 0)
                {
                    return;
                }
                if (eData.currentTakeInd < 0)
                {
                    eData.currentTakeInd = 0;
                }
                else if (eData.currentTakeInd >= _t.Count)
                {
                    eData.currentTakeInd = _t.Count - 1;
                }

                _t[eData.currentTakeInd].drawGizmos(eData.target, AnimateTimeline.e_gizmoSize, Application.isPlaying);
            }
        }
예제 #20
0
    public void playcard()
    {
        GameObject manager = GameObject.Find("_Manager");
        WarMain    warmain = manager.GetComponent <WarMain>();

        warmain.cardToScreenOpponent(0, 300);

        Animate animateScript = warmain.objectToAnimate.GetComponent <Animate>();

        animateScript.playAnimation(warmain.objectToAnimate);
        warmain.processturn();

        if (warmain.lastHandWinner == "PlayerOne")
        {
            //winMessage.animation.Play("left_entrance");
            ob = Instantiate(winMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            ob.transform.SetParent(GameObject.Find("Canvas").transform);
            //ob.transform.parent = GameObject.Find("Canvas").transform;
            ob.animation.Play();
        }
        if (warmain.lastHandWinner == "Opponent")
        {
            ob = Instantiate(loseMessage, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            ob.transform.SetParent(GameObject.Find("Canvas").transform);
            //ob.transform.parent = GameObject.Find("Canvas").transform;
            ob.animation.Play();
        }
        warmain.removePlayButton();
    }
예제 #21
0
        public MainWindow()
        {
            this.InitializeComponent();

            this.Loaded += (sender, args) =>
            {
                Animate animate = new Animate((sys, extents) =>
                {
                    Behavior <double> time   = sys.Time;
                    double maxSize           = 105;
                    Behavior <double> offset = time.Map(t =>
                    {
                        double frac = t - Math.Floor(t);
                        return((frac < 0.5 ? frac - 0.25 : 0.75 - frac) * 4.0 * maxSize);
                    });
                    Behavior <double> fifty = Behavior.Constant(50.0);
                    Behavior <DrawableDelegate> greenBall = Shapes.Translate(
                        Shapes.Scale(Shapes.Circle(Colors.Green), fifty),
                        offset.Map(x => new Point(x, 0.0)));
                    Behavior <DrawableDelegate> blueBall = Shapes.Translate(
                        Shapes.Scale(Shapes.Circle(Colors.Blue), fifty),
                        offset.Map(y => new Point(0.0, y)));
                    return(Shapes.Over(greenBall, blueBall));
                }, this.Placeholder.RenderSize);
                this.Placeholder.Children.Add(animate);
                animate.Start();
            };
        }
예제 #22
0
 public override void LoadModel()
 {
     charAsset    = GameLoader.Instance.LoadAssetSync("Resources/Prefabs/fly.prefab");
     charObj      = charAsset.GameObjectAsset;
     charObj.name = monsterInfo.charName;
     monsterAnim  = InitAnimate(charObj, monsterInfo.charName);
 }
예제 #23
0
 internal Select(PhosphorescenceScript pho, Init init, Render render)
 {
     _pho    = pho;
     _init   = init;
     _render = render;
     animate = new Animate(pho, init, this, render);
 }
예제 #24
0
파일: Game.cs 프로젝트: styoe/evo
    void CreateBomb()
    {
        var bombs = GameObject.FindGameObjectsWithTag("Bomb");

        // Destroy the ones out of range
        foreach (var b in bombs)
        {
            if (Vector3.Distance(player.transform.localPosition, b.transform.localPosition) > GameGridRadius || Vector3.Distance(player.transform.localScale, b.transform.localScale) > GameMaxScaleDifference)
            {
                Destroy(b);
            }
        }

        if (bombs.GetLength(0) < maxBombs)
        {
            var playerScale = player.transform.localScale.x;
            // var newBomb = Instantiate(bomb, new Vector3(Random.Range(-3*playerScale, 3*playerScale), 1, Random.Range(-3*playerScale, 3*playerScale)), Quaternion.identity);
            var newBomb = Instantiate(bomb, GetRandomInGameGridRadius(), Quaternion.identity);
            newBomb.tag  = "Bomb";
            newBomb.name = "Bomb";

            float bombScale = Random.Range(0.3f * playerScale, 1.5f * playerScale);
            Animate.Scale(newBomb, new Vector3(bombScale, bombScale, bombScale));
        }
    }
예제 #25
0
 public CustomAnimation(T start, T end, Animate animate)
 {
     this.animate = animate;
     this.Start   = start;
     this.End     = end;
     this.current = start;
 }
예제 #26
0
        /// <summary>
        /// Animate and move this tile from its current screen location
        /// to the newLocation
        /// </summary>
        /// <param name="newLocation">Parent coordinates of destination</param>
        /// <param name="speed">Speed of animation (enum)</param>

        public void MoveTo(System.Drawing.Point newLocation, Animate speed)
        {
            BringToFront();

            if (speed != Animate.None)
            {
                Point startLoc = Location;
                Point newLoc   = Location;

                int dX = newLocation.X - startLoc.X;
                int dY = newLocation.Y - startLoc.Y;

                for (int step = 1; step < 10; ++step)
                {
                    int factor = step * step;
                    Thread.Sleep(speed == Animate.Fast ? 1 : 5);

                    newLoc.X = startLoc.X + (dX * factor) / 100;
                    newLoc.Y = startLoc.Y + (dY * factor) / 100;
                    Location = newLoc;

                    Parent.Update();
                }
            }

            Location = newLocation;

            if (speed != Tile.Animate.None)
            {
                Parent.Update();
            }
        }
예제 #27
0
        public MainWindow()
        {
            this.InitializeComponent();

            this.Loaded += (sender, args) =>
            {
                Animate animate = new Animate((sys, extents) =>
                {
                    Behavior <double> time = sys.Time;
                    double t0                    = time.Sample();
                    double ballRadius            = 15;
                    double leftWall              = -extents.X + ballRadius;
                    double rightWall             = extents.X - ballRadius;
                    double floor                 = -extents.Y + ballRadius;
                    double roof                  = extents.Y - ballRadius;
                    Signal gravity               = new Signal(t0, 0, 0, -1200);
                    StreamLoop <Signal> sBounceX = new StreamLoop <Signal>();
                    StreamLoop <Signal> sBounceY = new StreamLoop <Signal>();
                    Cell <Signal> velx           = sBounceX.Hold(new Signal(t0, 0, 0, 350));
                    Cell <Signal> vely           = sBounceY.Hold(gravity.Integrate(0));
                    Cell <Signal> posx           = Signal.Integrate(velx, leftWall);
                    Cell <Signal> posy           = Signal.Integrate(vely, roof);
                    sBounceX.Loop(BounceAt(sys, velx, posx, leftWall).OrElse(BounceAt(sys, velx, posx, rightWall)));
                    sBounceY.Loop(BounceAt(sys, vely, posy, floor));
                    return(Shapes.Translate(Shapes.Scale(Shapes.Circle(Colors.Red), Behavior.Constant(ballRadius)), time.Lift(posx.AsBehavior(), posy.AsBehavior(), (t, x, y) => new Point(x.ValueAt(t), y.ValueAt(t)))));
                }, this.Placeholder.RenderSize);
                this.Placeholder.Children.Add(animate);
                animate.Start();
            };
        }
예제 #28
0
 void StoppedAttactingAlert()
 {
     Debug.Log("Stoped attacking");
     Animate.ChangeAnimationState("Idle", animator, currentDirection);
     IsIdle      = true;
     IsAttacking = false;
 }
예제 #29
0
    // Used to handle everything happens when spawns a child cell
    public IEnumerator ProduceChild()
    {
        if (bCanSpawn)
        {
            bCanSpawn = false;

            // Calling the Animate class for spawn animation
            Animate mAnimate;
            mAnimate = new Animate(this.transform);
            mAnimate.ExpandContract(0.1f, 1, 1.1f);

            if (Level_Manager.LevelID < 4)
            {
                EMController.Instance().ReduceNutrient();
            }
            // Randomize the interval time between spawns of child cells in terms of current difficulty
            float intervalTime = UnityEngine.Random.Range(
                1.25f / EMDifficulty.Instance().CurrentDiff,
                1.75f / EMDifficulty.Instance().CurrentDiff
                );

            if (Level_Manager.LevelID > 2)
            {
                intervalTime /= 1.2f;
            }
            yield return(new WaitForSeconds(intervalTime));

            if (m_EMFSM.AvailableChildNum < 100)
            {
                bCanSpawn = true;
            }
        }
    }
예제 #30
0
    /// <summary>
    /// Find, remove and replace matched tiles, then restart if a match was found
    /// </summary>
    private static IEnumerator UpdateField()
    {
        yield return(new WaitForSeconds(Duration.Short));

        Animate.Pop(_tiles, Match.Check(_tiles));

        if (Animate.TilesPoppedThisRound == 0)
        {
            Drag.AllowUnlock = true;
            yield break;
        }

        yield return(new WaitForSeconds(Duration.Medium));

        Drop();

        yield return(new WaitForSeconds(Duration.Wait));

        Fill();
        PanelController.AssignRoundValues();
        Drag.Lock = true;

        yield return(new WaitForSeconds(Duration.SafeWait));

        Check();
    }
예제 #31
0
    // This receives a transform (the player transform)
    public void HandleNotified(Bytes.Data data)
    {
        if (target != null)
        {
            return;
        }

        ObjectDataBytes objData = (ObjectDataBytes)data;

        SetTarget((Transform)objData.ObjectValue);
        canReturnToInitialPos = false;

        delayChasePlayer = Animate.Delay(2f, () =>
        {
            moving      = true;
            agent.speed = 4f;
            EventManager.Dispatch("playSound", new PlaySoundData("HORROR_HelpMe002"));
            animController.SetLoopedState(CrunchyToastAnim.Walking, prefix, true);

            // Set atk on
            GetComponentInChildren <Observer>().canDealDmg = true;

            // Has 3 seconds to close gap between him and player before having to return to inital pos if hes too far from player
            delayCanReturnToInitPos = Animate.Delay(3f, () => {
                canReturnToInitialPos = true;
            });
        });
    }
예제 #32
0
 void Start()
 {
     agent = GetComponent<NavMeshAgent> ();
     agent.velocity=Vector3.zero;
     anim = GetComponent<Animate>();
     SlidersObject = GameObject.FindGameObjectWithTag("Sliders");
     moveSlider=SlidersObject.GetComponent<ScrollScript>();
     anim.idle ();
 }
    // Start(): Us this for initialisation
    void Start()
    {
        array_Animate = new Animate[array_Transform.Length];
        mAnimate = new Animate(this.transform);

        for (int i = 0; i < array_Animate.Length; i++)
        {
            array_Animate[i] = new Animate(array_Transform[i]);
        }
    }
예제 #34
0
파일: Wood.cs 프로젝트: xcmel/FWPGame
        public Wood(Texture2D texture, Vector2 position, Vector2 mapPosition, Texture2D[] animateSequence, Texture2D burnt)
            : base(texture, position)
        {
            myMapPosition = mapPosition;

            myAnimateSequence = animateSequence;
            myAnimate = new Animate(animateSequence);
            SetUpAnimate();
            myBurnt = burnt;
            myState = new RegularState(this);
        }
예제 #35
0
파일: Tornado.cs 프로젝트: xcmel/FWPGame
 public Tornado(Texture2D[] animSeq, Vector2 position, Vector2 velocity, Vector2 mapPosition)
     : base(animSeq[0], position)
 {
     myMapPosition = mapPosition;
     myTexture = animSeq[0];
     myPosition = position;
     myVelocity = velocity;
     myAnimateSequence = animSeq;
     myAnimate = new Animate(animSeq);
     SetUpAnimate();
     name = "Tornado";
 }
예제 #36
0
파일: People.cs 프로젝트: xcmel/FWPGame
 public People(Texture2D texture, Vector2 position, Vector2 mapPosition, Texture2D[] burningSequence, Texture2D burnt, Texture2D electrocuted)
     : base(texture, position)
 {
     myMapPosition = mapPosition;
     name = "People";
     myBurningSequence = burningSequence;
     myBurning = new Animate(burningSequence);
     SetUpBurning();
     myBurnt = burnt;
     myElectrocuted = electrocuted;
     myState = new RegularState(this);
 }
예제 #37
0
 // ActivateIdleRotation(): Pushes an Animate.cs into update sequence
 public static bool ActivateIdleRotation(Animate _mAnimate)
 {
     for (int i = 0; i < s_arrayIdleRotation.Length; i++)
     {
         if (s_arrayIdleRotation[i] == null)
         {
             s_arrayIdleRotation[i] = _mAnimate;
             return true;
         }
     }
     Debug.LogWarning("AnimateHandler.ActivateIdleRotation(): Cache have reached its maximum limit, consider creating a bigger cache?");
     return false;
 }
예제 #38
0
파일: House.cs 프로젝트: xcmel/FWPGame
 public House(Texture2D texture, Vector2 position, Vector2 mapPosition, Texture2D[] animateSequence, Texture2D burnt,
     Texture2D lit)
     : base(texture, position)
 {
     myMapPosition = mapPosition;
     name = "House";
     myAnimateSequence = animateSequence;
     myAnimate = new Animate(animateSequence);
     SetUpAnimate();
     myBurnt = burnt;
     myLit = lit;
     myState = new RegularState(this);
 }
예제 #39
0
    void Awake()
    {
        if (s_miscUI == null)
            s_miscUI = this;
        else
            Destroy(this.gameObject);

        EnemyStunnedTextSpriteRen = transform.GetChild(0).GetComponent<SpriteRenderer>();

        EnemyStunnedTextSpriteRen.enabled = false;
        stunDisplayDuration = 0f;

        m_EnemyStunnedTextAnimate = new Animate(EnemyStunnedTextSpriteRen.transform);
    }
예제 #40
0
파일: Tree.cs 프로젝트: xcmel/FWPGame
 public Tree(Texture2D texture, Vector2 position, Vector2 mapPosition,
     Texture2D[] burningSequence, Texture2D burnt, Texture2D electrocute, Texture2D[] multiplyTree)
     : base(texture, position)
 {
     myMapPosition = mapPosition;
     name = "Tree";
     myBurningSequence = burningSequence;
     myBurning = new Animate(burningSequence);
     SetUpBurning();
     myBurnt = burnt;
     myElectrocute = electrocute;
     myMultiplySequence = multiplyTree;
     myMultiply = new Animate(multiplyTree);
     SetUpMultiply();
     myState = new RegularState(this);
 }
예제 #41
0
    //Constructor
    public ECMineState(GameObject _childCell, EnemyChildFSM _ecFSM)
    {
        m_Child = _childCell;
        m_ecFSM = _ecFSM;
        m_Main = m_ecFSM.m_EMain;

        m_ExpansionLimit = new Vector2(1.7f,1.7f);
        m_ShrinkLimit = new Vector2(0.8f,0.8f);
        m_PathToTarget = new List<Point>();
        m_Animator = new Animate(m_Child.transform);

        m_bExpanding = true;
        m_Target = null;
        m_CurrentTargetPoint = null;
        m_bExpandContractStart = false;

        m_fExpansionSpeed = 0.1f;
        m_fMaxAcceleration = 40f;
        m_fExplosiveRange = 4f * m_Child.GetComponent<SpriteRenderer>().bounds.size.x;
        m_fKillRange = 0.75f * m_fExplosiveRange;

        m_CurrentPositionType = PositionType.Empty;
    }
예제 #42
0
    void Awake()
    {
        Screen.SetResolution(360, 640, false);

        cameraTransform = GameObject.Find("Main Camera").transform;

        shouldSnapUp = false;
        shouldSnapDown = false;
        shouldSnapBack = false;
        isSnapping = false;
        _menuPosition = MainMenuPosition.Center;

        swipeTextCanvasGroup = transform.GetChild(4).GetComponent<CanvasGroup>();
        titleTransform = transform.GetChild(1);
        titleAnimate = new Animate(titleTransform);

        alienBodyImage = transform.GetChild(3).GetChild(0).GetComponent<Image>();
        alienBodyImage.sprite = alienBodySprites[Random.Range(0, alienBodySprites.Length)];
        backgroundImage = new SpriteRenderer[5];
        backgroundImage[0] = transform.GetChild(5).GetComponent<SpriteRenderer>();
        backgroundImage[1] = transform.GetChild(6).GetComponent<SpriteRenderer>();
        backgroundImage[2] = transform.GetChild(7).GetComponent<SpriteRenderer>();
        backgroundImage[3] = transform.GetChild(8).GetComponent<SpriteRenderer>();
        backgroundImage[4] = transform.GetChild(9).GetComponent<SpriteRenderer>();

        int randColor = Random.Range(0, backgroundColors.Length);
        for (int i = 0; i < backgroundImage.Length; i++)
        {
            backgroundImage[i].color = backgroundColors[randColor];
        }

        for (int i = 0; i < particleSystems.Length; i++)
        {
            particleSystems[i].startColor = backgroundColors[randColor];
            particleSystems[i].Clear();
            particleSystems[i].Simulate(particleSystems[i].startLifetime);
            particleSystems[i].Play();
        }
    }
예제 #43
0
 public void MoveUp(float speed)
 {
     if (!GameProperties.Instance.GameOver)
     {
         velocity -= speed;
         _animate = Animate.Flap;
         _timer = _animateTime;
     }
 }
예제 #44
0
        public override void Update(GameTime gameTime)
        {
            int elapsedMillis = gameTime.ElapsedGameTime.Milliseconds;
            _timer -= elapsedMillis;
            _delay -= elapsedMillis;
            if (_animate == Animate.Flap)
            {
                _lastFrame += elapsedMillis;
                if (_lastFrame > _frameSpeed && (_frameIndex < _birdInfo.Count - 2))
                {
                    _lastFrame = 0;
                    _frameIndex++;
                    if (_frameIndex >= _birdInfo.Count - 2)     //dont include banking images in animation loop
                    {
                        _frameIndex = 0;
                    }
                }
            }
            else if (_animate == Animate.Left)
            {
                if (_delay < 0)
                {
                    _frameIndex = 0;
                    _animate = Animate.NONE;
                }
                else
                    _frameIndex = 8;
            }
            else if (_animate == Animate.Right)
            {
                if (_delay < 0)
                {
                    _frameIndex = 0;
                    _animate = Animate.NONE;
                }
                else
                    _frameIndex = 9;
            }
            else
            {
                _frameIndex = 0;
            }

            //decrease velocity ( remember: it's negative to move up! )
            if (_timer < 0)
            {
                velocity = velocity * 0.9f;
                if (velocity < -0.05 && _animate != Animate.Left && _animate != Animate.Right)
                {
                    _animate = Animate.NONE;
                }
                _timer += _animateTime;
            }

            CheckBottomBorder();
            velocity = MathHelper.Clamp(velocity, -10, 2);
            float y = MathHelper.Clamp(Position.Y + velocity + 4, HEIGHT / 2, _game.GraphicsDevice.Viewport.Height * 2);
            Position = new Vector2(Position.X, y);
        }
예제 #45
0
 public void MoveLeft(float speed)
 {
     if (!GameProperties.Instance.GameOver)
     {
         float x = MathHelper.Clamp(Position.X - speed, GameProperties.Instance.BorderDensity, _game.GraphicsDevice.Viewport.Width - GameProperties.Instance.BorderDensity);
         Position = new Vector2(x, Position.Y + 1);
         _animate = Animate.Left;
         _delay = _animateTime;
     }
 }
예제 #46
0
    void Awake()
    {
        if (PlayerMain.s_Instance == null)
        {
            PlayerMain.s_Instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        m_bIsAlive = true;
        m_bNeedsResizing = false;
        m_nHealth = Settings.s_nPlayerInitialHealth;
        m_nMaxHealth = m_nHealth;
        mAnimate = new Animate(this.transform);
        spriteRen = gameObject.GetComponent<SpriteRenderer>();
        m_surroundingEnemyCells = null;
        m_Scale = new Vector3(m_fMaxScale, m_fMaxScale, m_fMaxScale);
        m_nDeathAnimStage = 0;
        transform.localScale = m_Scale;
    }
 // Pause the spawning process so that there are not too many mini cells taking too much computing power at the same time
 IEnumerator PauseSpawn()
 {
     bCanSpawn = false;
     // Pause for random amount of time depending on the size of the agent
     yield return new WaitForSeconds (Random.Range (Mathf.Sqrt (Mathf.Pow (nSize, 1f)), Mathf.Sqrt (Mathf.Pow (nSize, 3f))));
     // Double check if the main nutrient is in the map and not too close to the enemy main cell
     if (MapManager.Instance.IsInBounds ((Vector2)(position * 1.1f)) &&
         Vector2.Distance (EMHelper.Instance().Position, transform.position) > fInitialRadius * nSize + EMHelper.Instance ().Radius)
     {
         // Instantiate a mini nutrient object
         Instantiate (miniNutrient, position, Quaternion.identity);
         // Calling the Animate class for spawn animation
         Animate mAnimate;
         mAnimate = new Animate (this.transform);
         mAnimate.ExpandContract (0.1f, 1, 1.1f);
         // Reduce the size of the current main nutrient by 1
         nSize--;
     }
     bCanSpawn = true;
 }
예제 #48
0
        public PopupMenu()
        {
            // Create collection objects
            _drawCommands = new ArrayList();
            _menuCommands = new MenuCommandCollection();

            // Default the properties
            _returnDir = 0;
            _extraSize = 0;
            _popupItem = -1;
            _trackItem = -1;
            _childMenu = null;
            _exitLoop = false;
            _popupDown = true;
            _mouseOver = false;
            _excludeTop = true;
            _popupRight = true;
            _parentMenu = null;
            _excludeOffset = 0;
            _parentControl = null;
            _returnCommand = null;
            _controlLBrush = null;
            _controlEBrush = null;
            _controlLLBrush = null;
            _highlightInfrequent = false;
            _showInfrequent = false;
            _style = VisualStyle.IDE;
            _rememberExpansion = true;
            _lastMousePos = new Point(-1,-1);
            _direction = Direction.Horizontal;
            _textFont = SystemInformation.MenuFont;

            // Animation details
            _animateTime = 100;
            _animate = Animate.System;
            _animateStyle = Animation.System;
            _animateFirst = true;
            _animateIn = true;

            // Create and initialise the timer object (but do not start it running!)
            _timer = new Timer();
            _timer.Interval = _selectionDelay;
            _timer.Tick += new EventHandler(OnTimerExpire);

            // Define default colors
            _textColor = SystemColors.MenuText;
            _highlightTextColor = SystemColors.HighlightText;
            DefineHighlightColors(SystemColors.Highlight);
            DefineColors(SystemColors.Control);
        }
예제 #49
0
    // Start(): Use this for initialization
    void Start()
    {
        // Variable Initialisation
        m_Brain = this.GetComponent<PS_Logicaliser>();
        mAnimate = new Animate(this.transform);

        dict_States = new Dictionary<PSState, IPSState>();
        dict_States.Add(PSState.Idle, new PS_IdleState(this, m_Brain));
        dict_States.Add(PSState.Attack, new PS_AttackState(this));
        dict_States.Add(PSState.Defend, new PS_DefendState(this));
        dict_States.Add(PSState.Produce, new PS_ProduceState(this));
        dict_States.Add(PSState.FindResource, new PS_FindResourceState(this));
        dict_States.Add(PSState.Dead, new PS_DeadState(this));
        m_CurrentEnumState = PSState.Dead;
        m_CurrentState = dict_States[m_CurrentEnumState];
        m_CurrentState.Enter();
    }
예제 #50
0
        public MenuControl()
        {
            // Set default values
            lastX = -1;
            lastY = -1;
            _trackItem = -1;
            _oldFocus = IntPtr.Zero;
            _minButton = null;
            _popupMenu = null;
            _activeChild = null;
            _closeButton = null;
            _controlLPen = null;
            _mdiContainer = null;
            _restoreButton = null;
            _controlLBrush = null;
            _chevronStartCommand = null;
            _animateFirst = true;
            _exitLoop = false;
            _selected = false;
            _multiLine = false;
            _mouseOver = false;
            _defaultFont = true;
            _manualFocus = false;
            _drawUpwards = false;
            _plainAsBlock = false;
            _clientSubclass = null;
            _ignoreMouseMove = false;
            _deselectReset = true;
            _expandAllTogether = true;
            _rememberExpansion = true;
            _highlightInfrequent = true;
            _dismissTransfer = false;
            _style = VisualStyle.IDE;
            _direction = Direction.Horizontal;
            _menuCommands = new MenuCommandCollection();
            _glyphFading = GlyphFading.Default;
            this.Dock = DockStyle.Top;
            this.Cursor = System.Windows.Forms.Cursors.Arrow;

            // Animation details
            _animateTime = 100;
            _animate = Animate.System;
            _animateStyle = Animation.System;

            // Prevent flicker with double buffering and all painting inside WM_PAINT
            SetStyle(ControlStyles.DoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint |
                     ControlStyles.UserPaint, true);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);

            // Hookup to collection events
            _menuCommands.Cleared += new CollectionClear(OnCollectionCleared);
            _menuCommands.Inserted += new CollectionChange(OnCollectionInserted);
            _menuCommands.Removed += new CollectionChange(OnCollectionRemoved);

            // Need notification when the MenuFont is changed
            Microsoft.Win32.SystemEvents.UserPreferenceChanged +=
                new UserPreferenceChangedEventHandler(OnPreferenceChanged);

            DefineColors();

            // Set the starting Font
            DefineFont(SystemInformation.MenuFont);

            // Do not allow tab key to select this control
            this.TabStop = false;

            // Default to one line of items
            this.Height = _rowHeight;

            // Add ourself to the application filtering list
            Application.AddMessageFilter(this);
        }
예제 #51
0
 // Start(): Use this for initialization
 void Start()
 {
     // Definition of variables
     playerMainTransform = PlayerMain.Instance.transform;
     nCurrentSquadChildCount = 0;
     fSizeExpandPerSpawn = (fMaximumSizeIncrease - transform.localScale.x) / (float)nSquadChildToSpawn;
     mAnimate = new Animate(transform);
 }
예제 #52
0
 void Start()
 {
     anim =  GetComponent<Animate>();
         SlidersObject = GameObject.FindGameObjectWithTag("Sliders");
         moveSlider=SlidersObject.GetComponent<ScrollScript>();
 }
예제 #53
0
 void Start()
 {
     myView = this.GetComponent<PhotonView>();
         LifeScript = this.GetComponent<PlayerHealth>();
         ShootScript=this.GetComponent<Fire>();
         anim =  GetComponent<Animate>();
         SlidersObject = GameObject.FindGameObjectWithTag("Sliders");
         moveSlider=SlidersObject.GetComponent<ScrollScript>();
 }
예제 #54
0
    void Awake()
    {
        if (Instance == null)
            s_Instance = this;
        else
            Destroy(this.gameObject);

        s_nResources = Settings.s_nPlayerInitialResourceCount;

        m_SquadCaptainNode = GameObject.Find("Node_Captain_SpawnPos").transform;
        spwnCptBtnGO = transform.GetChild(3).GetChild(0).gameObject;
        spawnCtrlCanvasGrp = transform.GetChild(3).GetComponent<CanvasGroup>();
        leftNodeCanvasGrp = transform.GetChild(4).GetComponent<CanvasGroup>();
        rightNodeCanavsGrp = transform.GetChild(5).GetComponent<CanvasGroup>();
        mainCellPos = transform.GetChild(6).GetComponent<RectTransform>().localPosition;
        spwnCptBtnRectTransform = spawnCtrlCanvasGrp.transform.GetChild(0).GetComponent<RectTransform>();
        spwnCptBtnPos = spwnCptBtnRectTransform.localPosition;
        playerHurtTintCanvasGrp = transform.GetChild(7).GetChild(0).GetComponent<CanvasGroup>();
        enemyWarningTintCanvasGrp = transform.GetChild(7).GetChild(1).GetComponent<CanvasGroup>();
        leftNodeChildText = transform.GetChild(7).GetChild(2).GetChild(0).GetComponent<Text>();
        rightNodeChildText = transform.GetChild(7).GetChild(2).GetChild(1).GetComponent<Text>();
        nutrientText = transform.GetChild(7).GetChild(3).GetComponent<Text>();
        infoPanelCanvasGrp = transform.GetChild(7).GetChild(4).GetComponent<CanvasGroup>();
        infoText = transform.GetChild(7).GetChild(4).GetChild(0).GetComponent<Text>();
        pausePanelCanvasGrp = transform.GetChild(8).GetComponent<CanvasGroup>();
        pauseButtonImage = transform.GetChild(9).GetComponent<Image>();

        controlImages = new Image[9];
        controlImages[0] = transform.GetChild(4).GetChild(3).GetComponent<Image>();	// Left BurstShot.
        controlImages[1] = transform.GetChild(4).GetChild(2).GetComponent<Image>();	// Left SwarmTarget.
        controlImages[2] = transform.GetChild(4).GetChild(1).GetComponent<Image>();	// Left ScatterShot.
        controlImages[3] = transform.GetChild(4).GetChild(0).GetComponent<Image>();	// Left DefendAvoid.
        controlImages[4] = transform.GetChild(5).GetChild(3).GetComponent<Image>();	// Right BurstShot.
        controlImages[5] = transform.GetChild(5).GetChild(2).GetComponent<Image>();	// Right SwarmTarget.
        controlImages[6] = transform.GetChild(5).GetChild(1).GetComponent<Image>();	// Right ScatterShot.
        controlImages[7] = transform.GetChild(5).GetChild(0).GetComponent<Image>();	// Right DefendAvoid.
        controlImages[8] = transform.GetChild(3).GetChild(0).GetComponent<Image>();	// SpwnCpt Btn.

        for (int i = 0; i < controlImages.Length; i++)
        {
            controlImages[i].color = m_unselectedColor;
        }

        // Hide controls, tints, and info panel.
        spawnCtrlCanvasGrp.alpha = 0f;
        leftNodeCanvasGrp.alpha = 0f;
        rightNodeCanavsGrp.alpha = 0f;
        DeselectAllCtrls();
        playerHurtTintCanvasGrp.alpha = 0f;
        enemyWarningTintCanvasGrp.alpha = 0f;
        infoPanelCanvasGrp.alpha = 0f;
        SetPausePanelVisibility(false);
        pauseButtonImage.enabled = true;

        // Initialize spawn variables
        m_bIsHoldingDownSpawnBtn = false;
        m_fHoldTime = 0f;

        // Create Animate objects.
        m_ResourceTextAnimate = new Animate(transform.GetChild(7).GetChild(3));
        m_LeftNodeChildTextAnimate = new Animate(transform.GetChild(7).GetChild(2).GetChild(0));
        m_RightNodeChildTextAnimate = new Animate(transform.GetChild(7).GetChild(2).GetChild(1));
    }
예제 #55
0
    // Private Functions
    // Awake(): is called at the start of the program
    void Awake()
    {
        // Singleton
        if (s_Instance == null)
            s_Instance = this;
        else
            Destroy(this.gameObject);

        float resultColor;
        // while: Initialise a color and checks if the color is acceptable
        // Since HSV input of colors is harder to implement,
        // it converts RGB into one OVERALL value and check if is within fMinimumArtilleryRGB and fMaximumArtilleryRGB range
        do
        {
            colorArtillery = new Color(UnityEngine.Random.value, UnityEngine.Random.value, UnityEngine.Random.value, 1f);
            resultColor = colorArtillery.r + colorArtillery.g + colorArtillery.b;

        } while (resultColor < 3f * fMinimumArtilleryRGB || resultColor > 3f * fMaximumArtilleryRGB);

        // Read level specific settings from Settings.cs
        colorArtillery = Settings.s_EnvironmentColor;
        fNutrientsChance = Settings.s_fPlayerNutrientChance;
        fWallSidesSpeed = Settings.s_fSideWallSpeed;
        fWallBackgroundSpeed = Settings.s_fBackgroundSpeed;

        // Background particle system set-up
        bgParticleSystem = transform.GetChild(2).GetComponent<ParticleSystem>();
        // Use the same color as the wall-sides and background
        bgParticleSystem.startColor = colorArtillery;
        // Set the starting speed from Settings.cs
        bgParticleSystem.startSpeed = Settings.s_fParticleStartSpeedMultiplier;
        // Since prewarm of particle systems doesn't adapt to the new color, the particle system will be simulated beforehand
        bgParticleSystem.Clear();
        bgParticleSystem.Simulate(bgParticleSystem.startLifetime);
        bgParticleSystem.Play();

        mAnimate = new Animate(transform.GetChild(0)); // Pool_WallSidesRenderer
    }
예제 #56
0
 void Start()
 {
     anim = catapult.GetComponent<Animate>();
 }