void OnButton3Clicked(object sender, EventArgs args)
        {
            Button button = (Button)sender;

            // Create parent animation object.
            Animation parentAnimation = new Animation();

            // Create "up" animation and add to parent.
            Animation upAnimation = new Animation(
                v => button.Scale = v,
                1, 5, Easing.SpringIn,
                () => Debug.WriteLine("up finished"));

            parentAnimation.Add(0, 0.5, upAnimation);

            // Create "down" animation and add to parent.
            Animation downAnimation = new Animation(
                v => button.Scale = v,
                5, 1, Easing.SpringOut,
                () => Debug.WriteLine("down finished"));

            parentAnimation.Insert(0.5, 1, downAnimation);

            // Commit parent animation
            parentAnimation.Commit(
                this, "Animation3", 16, 5000, null,
                (v, c) => Debug.WriteLine("parent finished: {0} {1}", v, c));
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NControlDemo.FormsApp.Controls.ProgressControl"/> class.
        /// </summary>
        public ProgressControl()
        {
            BackgroundColor = Xamarin.Forms.Color.Gray;

            var cog1 = new FontAwesomeLabel{ 
                Text = FontAwesomeLabel.FACog,
                FontSize = 39,
                TextColor = Xamarin.Forms.Color.FromHex("#CECECE"),
                XAlign = Xamarin.Forms.TextAlignment.Center,
                YAlign = Xamarin.Forms.TextAlignment.Center,
            };

            var cog2 = new FontAwesomeLabel{ 
                Text = FontAwesomeLabel.FACog,
                FontSize = 18,
                TextColor = Xamarin.Forms.Color.FromHex("#CECECE"),
                XAlign = Xamarin.Forms.TextAlignment.Center,
                YAlign = Xamarin.Forms.TextAlignment.Center,
            };
                
            _animation = new Animation((val) => {
                cog1.Rotation = val;
                cog2.Rotation = -val;
            }, 0, 360, Easing.Linear);

            var layout = new RelativeLayout();
            layout.Children.Add(cog1, () => new Xamarin.Forms.Rectangle((-layout.Width/4) + 8, (layout.Height/4) - 8, 
                layout.Width, layout.Height));
            
            layout.Children.Add(cog2, () => new Xamarin.Forms.Rectangle(layout.Width -36, -13, 
                layout.Width, layout.Width));

            Content = layout;
        }
    public void check_speed()
    {
        if (X1.isOn)
            speed = 1;
        else if (X2.isOn)
            speed = 2;
        else if (X4.isOn)
            speed = 4;
        else if (X8.isOn)
            speed = 8;
        else if (X16.isOn)
            speed = 16;
        else if (X32.isOn)
            speed = 32;
        else if (X64.isOn)
            speed = 600;

        for (float i=0; i<20; i++) {
            for (float j=-0; j<20; j++) {
                ammo = GameObject.Find (i.ToString () + "," + j.ToString () + "terrain");
                anim = ammo.gameObject.GetComponent<Animation>();
                //anim.Play("anim");
                anim["anim"].speed =speed;
            }
        }
        Debug.Log ("speed : " + anim["anim"].speed);
    }
Example #4
0
 public void realPlay( Animation am )
 {
     //am[ ANIMATION_NAME ].weight   = 100;
     //am[ ANIMATION_NAME ].layer    = AnimationLayer.NORMAL;
     //am[ ANIMATION_NAME ].wrapMode = WrapMode.Once;
     //am.CrossFade( ANIMATION_NAME );
 }
Example #5
0
 void Start()
 {
     fire = FindObjectsOfType<AudioSource>().Where(w => w.name == "Fire").FirstOrDefault();
     animation = GetComponent<Animation>();
     Switch_Monstr = 0;
     Switch_Player_Cube = false;
 }
    //public GameObject _player;
    //public float _distance;
    // Use this for initialization
    void Start()
    {
        _animation = GetComponent<Animation> ();
        string _animationToPlay = _animationClip.name.ToString();

        //int animCount = _animation.GetClipCount(); // clip?! Unity people, why not state??
        //Debug.Log("Animations found: " + animCount );

        //_player = GameObject.FindGameObjectWithTag("Player");

        _animation[_animationToPlay].wrapMode = WrapMode.Loop;

        _animation.PlayQueued(_animationToPlay, QueueMode.CompleteOthers);

        //		foreach(AnimationState s in _animation) {
        //
        //			string theName = s.name.ToString();
        //			//_animation[theName].wrapMode = WrapMode.Once;
        //			_animation.PlayQueued(theName, QueueMode.CompleteOthers);
        //
        //
        //
        //		}
        //
    }
Example #7
0
    PlayerHealth playerHealth; // Reference to the player's health.

    #endregion Fields

    #region Methods

    void Awake()
    {
        enemyHealth = GetComponent<EnemyHealth>();
        nav = GetComponent<NavMeshAgent>();
        animation = GetComponent<Animation>();
        lebosspeutbouger = true;
    }
Example #8
0
 // Use this for initialization
 void Start()
 {
     anim = gameObject.GetComponent<Animation> ();
     sc = gameObject.GetComponent<SphereCollider> ();
     bc = gameObject.GetComponent<BoxCollider> ();
     initSound ();
 }
Example #9
0
    void Awake()
    {
        agent = GetComponent<NavMeshAgent>();
        obstacle = GetComponent<NavMeshObstacle>();
        m_Animation = GetComponentInChildren<Animation>();
        enemyAttack = GetComponent<EnemyAttack>();
        stats = GetComponent<UnitStats>();
        m_AudioSource = GetComponent<AudioSource>();
        baseAttackSpeedCache = timeBetweenAttacks;

        switch (unitType)
        {
            case EnemyTypes.Minion:
                selectedAction = "Punch";
                break;

            case EnemyTypes.Brute:
                selectedAction = "Slam";
                break;

            case EnemyTypes.Evoker:
                selectedAction = "Shoot";
                break;

            case EnemyTypes.Bob:
                selectedAction = "Explode";
                break;

            default:
                break;
        }
    }
Example #10
0
    public void coroutineAnimation(Animation a, CompleteDelegate completeDeletgate)
    {
        object[] parameters = new object[2]{a, completeDeletgate};

        StatusManager.enableNextOrder = false;
        StartCoroutine("animationWait",parameters);
    }
        protected override Asset Read(BinaryReader input)
        {
            String name = input.ReadString();
            Animation animation = new Animation(name);

            int framesCount = input.ReadInt32();

            AnimationFrame[] frames = new AnimationFrame[framesCount];
            for (int frameIndex = 0; frameIndex < frames.Length; ++frameIndex)
            {
                frames[frameIndex].x = input.ReadInt32();
                frames[frameIndex].y = input.ReadInt32();
                frames[frameIndex].ox = input.ReadInt32();
                frames[frameIndex].oy = input.ReadInt32();
                frames[frameIndex].w = input.ReadInt32();
                frames[frameIndex].h = input.ReadInt32();
                frames[frameIndex].duration = input.ReadInt32() * 0.001f;
            }

            animation.frames = frames;

            int textureSize = input.ReadInt32();
            byte[] data = input.ReadBytes(textureSize);

            using (MemoryStream stream = new MemoryStream(data))
            {
                Texture2D texture = Texture2D.FromStream(Runtime.graphicsDevice, stream);
                animation.texture = new TextureImage(texture);
            }

            return animation;
        }
Example #12
0
    // Use this for initialization
    void Start()
    {
        anim = this.GetComponent<Animation> ();

        //		this.transform.position = Vector3.zero; // make sure the paddle is centered to the base
        //		this.transform.position += new Vector3 (0, startingYOffset, 0);// this will adjust the position to to below the base when the
    }
	void Start()
	{
		if (Timer == null) Timer = GetComponent<CountdownTimer>();
		if (Timer == null) 
		{
			enabled = false;
			return;
		}
		
		if (Target == null) Target = animation;
		if (Target == null) 
		{
			enabled = false;
			return;
		}
		
		cl = animation.GetClip(AnimationName);
		if (cl == null) 
		{
			Debug.LogError("Animation " + AnimationName + " not found on object");
			return;
		}
		
		if (!Blend)
		{
			animation.Play(AnimationName);
		}
		else
		{
			animation.Blend(AnimationName, BlendWeight, 0f);
		}
		
		st = animation[AnimationName];
		st.speed = 0;
	}
Example #14
0
    /// <summary>
    /// Will set the Animation with the supplied parameter
    /// </summary>
    /// <param name="animation">The Animation to set</param>
    /// <param name="animator">The animator to get the Animations</param>
    /// <param name="parameter">The value for the Animation</param>
    public static void setAnimationTypeAndValue(Animation animation, Animator animator, object value)
    {
        if(value == null) {
            return;
        }

        //Grab what Type of parameter
        AnimatorControllerParameter param = getAnimatorControllerParameter(animation, animator);

        //If param doesn't exist, just get out
        if(param == null) {
            return;
        }

        switch(param.type) {
            case AnimatorControllerParameterType.Bool:
                animator.SetBool(animation.ToString(), (bool)value);
                break;
            case AnimatorControllerParameterType.Float:
                animator.SetFloat(animation.ToString(), (float)value);
                break;
            case AnimatorControllerParameterType.Int:
                animator.SetInteger(animation.ToString(), (int)value);
                break;
            case AnimatorControllerParameterType.Trigger:
                animator.SetTrigger(animation.ToString());
                break;
            default:
                break;
        }
    }
Example #15
0
	void Awake ()
	{
		onFire = false;
		announcerAudio = GetComponents<AudioSource> () [1];
		playerAttack = GetComponent<PlayerAttack> ();

		canvas = GameObject.Find ("HUDCanvas");
		//Debug.Log ("PlayerHealthUI_" + playerAttack.playerNum);

		inGameHealthUI = canvas.GetComponent<RectTransform> ().Find ("PlayerHealthUI_" + playerAttack.playerNum)
			.GetComponent<InGameHealthUI>();
		inGameHealthUI.playerHealth = this;
		rigid = GetComponent<Rigidbody> ();
		gm = GameObject.Find ("GameManager").GetComponent<GameManager> ();
		uim = GameObject.Find ("GameManager").GetComponent<UI_Manager> ();
		joystickNum = playerAttack.joystickNum;
		damageReduction = 1;
		allgrounds = GameObject.FindGameObjectsWithTag("Island");
		anim = GetComponent <Animation> ();
		playerAudio = GetComponent <AudioSource> ();
		playerMovement = GetComponent <PlayerMovement> ();

		//playerShooting = GetComponentInChildren <PlayerShooting> ();
		currentHealth = startingHealth;
		SetupHealthUI ();
	}
 // If target or rigidbody are not set, try using fallbacks
 void Setup()
 {
     if (target == null)
     {
         target = GetComponent<Animation> ();
     }
 }
Example #17
0
	// Use this for initialization
	void Start () {
		isSomethingOnTrigger = false;
		objectsOnTrigger = new List<Collider> ();
		isOpen = false;
		anim = this.GetComponentInChildren<Animation> ();
		time = anim["pression"].time;
	}
Example #18
0
 void OnEnable()
 {
     mAnim = animation;
     mRect = new Rect();
     mTrans = transform;
     mWidget = GetComponent<UIWidget>();
 }
Example #19
0
 // Use this for initialization
 void Awake()
 {
     CS = CharacterState.Idle;
     tr = GetComponent<Transform> ();
     ani = GameObject.Find ("Character1").GetComponent<Animation> ();
     GetComponent<Rigidbody> ().WakeUp ();
 }
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
        EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay) return null;

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);

            // Refresh all panels right away so that there is no one frame delay
            UIPanel[] panels = anim.gameObject.GetComponentsInChildren<UIPanel>();
            for (int i = 0, imax = panels.Length; i < imax; ++i) panels[i].Refresh();
        }

        ActiveAnimation aa = anim.GetComponent<ActiveAnimation>();
        if (aa == null) aa = anim.gameObject.AddComponent<ActiveAnimation>();
        aa.mAnim = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.eventReceiver = null;
        aa.callWhenFinished = null;
        aa.onFinished = null;
        aa.Play(clipName, playDirection);
        return aa;
    }
 //  
 public AnimationInstance(Animation anim)
 {
   animation_ = anim;
   frameRate_ = anim.FrameRate;
   //  The time of the last frame is less than the duration of the animation,
   //  as the last frame has some duration itself.
   lastFrameTime_ = (anim.NumFrames - 1) / frameRate_;
   invFrameRate_ = 1.0f / frameRate_;
   duration_ = anim.NumFrames * invFrameRate_;
   int max = 0;
   //  calculate max bone index
   //  todo: do in content pipeline
   foreach (KeyValuePair<int, AnimationTrack> kvp in anim.Tracks)
   {
     if (kvp.Key >= max)
       max = kvp.Key + 1;
   }
   //  Allocate animation keyframes (for lerping between times).
   keyframes_ = new Keyframe[max];
   //  Load all the tracks (one track per bone).
   tracks_ = new AnimationTrack[max];
   foreach (int i in anim.Tracks.Keys)
   {
     keyframes_[i] = new Keyframe();
     tracks_[i] = anim.Tracks[i];
   }
 }
 void Start()
 {
     anim = GetComponent<Animation> ();
     navMap = gameObject.GetComponent<NavMeshAgent> ();
     MaxHealth = 100;
     Health = MaxHealth;
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     Animation animation = new Animation();
     animation.Type = DropDownList1.SelectedValue;
     try
     {
         animation.Cascade = double.Parse(TextBox1.Text);
     }
     catch (Exception)
     {
         TextBox1.Text = "1";
         animation.Cascade = 1;
     }
     try
     {
         animation.Delay = double.Parse(TextBox2.Text);
     }
     catch (Exception)
     {
         TextBox2.Text = "0.5";
         animation.Delay = 0.5;
     }
     line1.OnShowAnimation = animation;
     OpenFlashChartControl1.Chart = chart;
 }
Example #24
0
	void Start () 
    {
        player = GameObject.Find("Player");
        playerState = player.GetComponent<PlayerState>();
        ani = GetComponent<Animation>();
        ani.Play("Idle");
	}
	/// <summary>
	/// Find all idle animations.
	/// </summary>

	void Start ()
	{
		mAnim = GetComponentInChildren<Animation>();
		
		if (mAnim == null)
		{
			Debug.LogWarning(NGUITools.GetHierarchy(gameObject) + " has no Animation component");
			Destroy(this);
		}
		else
		{
			foreach (AnimationState state in mAnim)
			{
				if (state.clip.name == "idle")
				{
					state.layer = 0;
					mIdle = state.clip;
					mAnim.Play(mIdle.name);
				}
				else if (state.clip.name.StartsWith("idle"))
				{
					state.layer = 1;
					mBreaks.Add(state.clip);
				}
			}
		
			// No idle breaks found -- this script is unnecessary
			if (mBreaks.Count == 0) Destroy(this);
		}
	}
Example #26
0
 public void Start () {
     anim = GetComponent<Animation>();
     animState = anim[anim.clip.name];
     // reset effects
     percent = 0;
     Sample();
 }
Example #27
0
	void Start () {
	
		anim = GetComponent<Animation> ();
		death = false;

		enemies = 12;
	}
 // Use this for initialization
 void Start()
 {
     m_Animation = GetComponent<Animation>();
     m_CurrentKeyState = Idle;
     m_StartPos = transform.position;
     m_TargetPos = m_StartPos;
 }
 // Use this for initialization
 void Start()
 {
     // set animation
     this.animation = GetComponent<Animation> ();
     // set fire ligth
     this.fireLigth = this.effects.GetComponent<Light> ();
 }
Example #30
0
    void Start()
    {
        animation = GetComponent<Animation>();
		_source = GetComponent<AudioSource>();

		_madeNoise = false;
    }
Example #31
0
 void Awake()
 {
     mTrans = transform;
     mAnim  = GetComponent <Animation>();
     mRect  = new Rect();
 }
Example #32
0
	void Awake ()
	{
		mAnim = animation;
		mRect = new Rect();
		mTrans = transform;
	}
Example #33
0
        /// <summary>
        /// Pops the top page from Navigator.
        /// </summary>
        /// <returns>The popped page.</returns>
        /// <exception cref="InvalidOperationException">Thrown when there is no page in Navigator.</exception>
        /// <since_tizen> 9 </since_tizen>
        public Page Pop()
        {
            if (!transitionFinished)
            {
                Tizen.Log.Error("NUI", "Transition is still not finished.\n");
                return(null);
            }

            if (navigationPages.Count == 0)
            {
                throw new InvalidOperationException("There is no page in Navigator.");
            }

            var curTop = Peek();

            if (navigationPages.Count == 1)
            {
                Remove(curTop);

                //Invoke Popped event
                Popped?.Invoke(this, new PoppedEventArgs()
                {
                    Page = curTop
                });

                return(curTop);
            }

            var newTop = navigationPages[navigationPages.Count - 2];

            //Invoke Page events
            newTop.InvokeAppearing();
            curTop.InvokeDisappearing();
            curTop.SaveKeyFocus();

            //TODO: The following transition codes will be replaced with view transition.
            InitializeAnimation();

            if (curTop is DialogPage == false)
            {
                curAnimation = new Animation(1000);
                curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
                curAnimation.EndAction = Animation.EndActions.StopFinal;
                curAnimation.Finished += (object sender, EventArgs e) =>
                {
                    //Removes the current top page after transition is finished.
                    Remove(curTop);
                    curTop.Opacity = 1.0f;

                    //Invoke Page events
                    curTop.InvokeDisappeared();

                    //Invoke Popped event
                    Popped?.Invoke(this, new PoppedEventArgs()
                    {
                        Page = curTop
                    });
                };
                curAnimation.Play();

                newTop.Opacity = 1.0f;
                newTop.SetVisible(true);
                newAnimation = new Animation(1000);
                newAnimation.AnimateTo(newTop, "Opacity", 1.0f, 0, 1000);
                newAnimation.EndAction = Animation.EndActions.StopFinal;
                newAnimation.Finished += (object sender, EventArgs e) =>
                {
                    // Need to update Content of the new page
                    ShowContentOfPage(newTop);

                    //Invoke Page events
                    newTop.InvokeAppeared();

                    newTop.RestoreKeyFocus();
                };
                newAnimation.Play();
            }
            else
            {
                Remove(curTop);
            }

            return(curTop);
        }
Example #34
0
        /// <summary>
        /// Pushes a page to Navigator.
        /// If the page is already in Navigator, then it is not pushed.
        /// </summary>
        /// <param name="page">The page to push to Navigator.</param>
        /// <exception cref="ArgumentNullException">Thrown when the argument page is null.</exception>
        /// <since_tizen> 9 </since_tizen>
        public void Push(Page page)
        {
            if (!transitionFinished)
            {
                Tizen.Log.Error("NUI", "Transition is still not finished.\n");
                return;
            }

            if (page == null)
            {
                throw new ArgumentNullException(nameof(page), "page should not be null.");
            }

            //Duplicate page is not pushed.
            if (navigationPages.Contains(page))
            {
                return;
            }

            var curTop = Peek();

            if (!curTop)
            {
                Insert(0, page);
                return;
            }

            navigationPages.Add(page);
            Add(page);
            page.Navigator = this;

            //Invoke Page events
            page.InvokeAppearing();
            curTop.InvokeDisappearing();

            curTop.SaveKeyFocus();

            //TODO: The following transition codes will be replaced with view transition.
            InitializeAnimation();

            if (page is DialogPage == false)
            {
                curAnimation = new Animation(1000);
                curAnimation.AnimateTo(curTop, "Opacity", 1.0f, 0, 1000);
                curAnimation.EndAction = Animation.EndActions.StopFinal;
                curAnimation.Finished += (object sender, EventArgs args) =>
                {
                    curTop.SetVisible(false);

                    //Invoke Page events
                    curTop.InvokeDisappeared();
                };
                curAnimation.Play();

                page.Opacity = 0.0f;
                page.SetVisible(true);
                newAnimation = new Animation(1000);
                newAnimation.AnimateTo(page, "Opacity", 1.0f, 0, 1000);
                newAnimation.EndAction = Animation.EndActions.StopFinal;
                newAnimation.Finished += (object sender, EventArgs e) =>
                {
                    // Need to update Content of the new page
                    ShowContentOfPage(page);

                    //Invoke Page events
                    page.InvokeAppeared();
                    NotifyAccessibilityStatesChangeOfPages(curTop, page);

                    page.RestoreKeyFocus();
                };
                newAnimation.Play();
            }
            else
            {
                ShowContentOfPage(page);
                page.RestoreKeyFocus();
            }
        }
 private void OnDestroy()
 {
     this.mAnim_MennuCollect = null;
     this.mOnFinishedCollectAnimationListener = null;
     this.mTargetMenuButton = null;
 }
Example #36
0
 public static extern void SetAnimationClips(Animation animation, AnimationClip[] clips);
Example #37
0
 public static AnimationClip[] GetAnimationClips(Animation component)
 {
     return(AnimationUtility.GetAnimationClips(component.gameObject));
 }
Example #38
0
 private void Animations_ItemClick(Animation obj)
 {
     AnimationClick?.Invoke(obj);
 }
Example #39
0
 void Start()
 {
     Run = GetComponent <Animation>();
 }
Example #40
0
        public static bool CheckForAnimator(GameObject root, bool needAnimatorBox = true, bool drawInactiveWarning = true)
        {
            Animation animation = null;
            Animator  animator  = root.GetComponentInChildren <Animator>();

            if (!animator)
            {
                if (root.transform.parent)
                {
                    if (root.transform.parent.parent)
                    {
                        animator = root.transform.parent.parent.GetComponentInChildren <Animator>();
                    }
                    else
                    {
                        animator = root.transform.parent.GetComponent <Animator>();
                    }
                }
            }

            if (!animator)
            {
                animation = root.GetComponentInChildren <Animation>();
                if (!animation)
                {
                    if (root.transform.parent)
                    {
                        if (root.transform.parent.parent)
                        {
                            animation = root.transform.parent.parent.GetComponentInChildren <Animation>();
                        }
                        else
                        {
                            animation = root.transform.parent.GetComponent <Animation>();
                        }
                    }
                }
            }

            if (animator)
            {
                if (animator.runtimeAnimatorController == null)
                {
                    EditorGUILayout.HelpBox("No 'Animator Controller' inside Animator", MessageType.Warning);
                    animator = null;
                }
            }

            if (needAnimatorBox)
            {
                if (animator == null && animation == null)
                {
                    GUILayout.Space(-4);
                    FGUI_Inspector.DrawWarning(" ANIMATOR NOT FOUND! ");
                    GUILayout.Space(2);
                }
                else
                if (drawInactiveWarning)
                {
                    bool drawInact = false;
                    if (animator != null)
                    {
                        if (animator.enabled == false)
                        {
                            drawInact = true;
                        }
                    }
                    if (animation != null)
                    {
                        if (animation.enabled == false)
                        {
                            drawInact = true;
                        }
                    }
                    if (drawInact)
                    {
                        GUILayout.Space(-4);
                        FGUI_Inspector.DrawWarning(" ANIMATOR IS DISABLED! ");
                        GUILayout.Space(2);
                    }
                }
            }

            if (animator != null || animation != null)
            {
                if (animator)
                {
                    if (!animator.enabled)
                    {
                        return(false);
                    }
                }
                if (animation)
                {
                    if (!animation.enabled)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #41
0
 public void JumpTime2()
 {
     anim2 = GameObject.Find("CameraObject").GetComponent <Animation>();
     anim2.Play("CameraJump");
     print("clip 2 played");
 }
Example #42
0
    public static int GetComponent1_wrap(long L)
    {
        try
        {
            long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L);
            UnityEngine.GameObject obj = get_obj(nThisPtr);
            string arg0    = FCLibHelper.fc_get_string_a(L, 0);
            long   nRetPtr = 0;
            switch (arg0)
            {
            case "SkinnedMeshRenderer":
            {
                SkinnedMeshRenderer ret_obj = obj.GetComponent <SkinnedMeshRenderer>();
                nRetPtr = FCGetObj.PushObj <SkinnedMeshRenderer>(ret_obj);
            }
            break;

            case "Renderer":
            {
                Renderer ret_obj = obj.GetComponent <Renderer>();
                nRetPtr = FCGetObj.PushObj <Renderer>(ret_obj);
            }
            break;

            case "MeshRenderer":
            {
                MeshRenderer ret_obj = obj.GetComponent <MeshRenderer>();
                nRetPtr = FCGetObj.PushObj <MeshRenderer>(ret_obj);
            }
            break;

            case "Animation":
            {
                Animation ret_obj = obj.GetComponent <Animation>();
                nRetPtr = FCGetObj.PushObj <Animation>(ret_obj);
            }
            break;

            case "Collider":
            {
                Collider ret_obj = obj.GetComponent <Collider>();
                nRetPtr = FCGetObj.PushObj <Collider>(ret_obj);
            }
            break;

            case "BoxCollider":
            {
                BoxCollider ret_obj = obj.GetComponent <BoxCollider>();
                nRetPtr = FCGetObj.PushObj <BoxCollider>(ret_obj);
            }
            break;

            case "BoxCollider2D":
            {
                BoxCollider2D ret_obj = obj.GetComponent <BoxCollider2D>();
                nRetPtr = FCGetObj.PushObj <BoxCollider2D>(ret_obj);
            }
            break;

            case "MeshCollider":
            {
                MeshCollider ret_obj = obj.GetComponent <MeshCollider>();
                nRetPtr = FCGetObj.PushObj <MeshCollider>(ret_obj);
            }
            break;

            case "SphereCollider":
            {
                SphereCollider ret_obj = obj.GetComponent <SphereCollider>();
                nRetPtr = FCGetObj.PushObj <SphereCollider>(ret_obj);
            }
            break;

            case "Rigidbody":
            {
                Rigidbody ret_obj = obj.GetComponent <Rigidbody>();
                nRetPtr = FCGetObj.PushObj <Rigidbody>(ret_obj);
            }
            break;

            case "Camera":
            {
                Camera ret_obj = obj.GetComponent <Camera>();
                nRetPtr = FCGetObj.PushObj <Camera>(ret_obj);
            }
            break;

            case "AudioSource":
            {
                AudioSource ret_obj = obj.GetComponent <AudioSource>();
                nRetPtr = FCGetObj.PushObj <AudioSource>(ret_obj);
            }
            break;

            case "Transform":
            {
                Transform ret_obj = obj.GetComponent <Transform>();
                nRetPtr = FCGetObj.PushObj <Transform>(ret_obj);
            }
            break;

            case "Component":
            {
                Component ret_obj = obj.GetComponent <Component>();
                nRetPtr = FCGetObj.PushObj <Component>(ret_obj);
            }
            break;

            case "ParticleSystem":
            {
                ParticleSystem ret_obj = obj.GetComponent <ParticleSystem>();
                nRetPtr = FCGetObj.PushObj <ParticleSystem>(ret_obj);
            }
            break;

            case "Light":
            {
                Light ret_obj = obj.GetComponent <Light>();
                nRetPtr = FCGetObj.PushObj <Light>(ret_obj);
            }
            break;

            case "Button":
            {
                Button ret_obj = obj.GetComponent <Button>();
                nRetPtr = FCGetObj.PushObj <Button>(ret_obj);
            }
            break;

            case "Text":
            {
                Text ret_obj = obj.GetComponent <Text>();
                nRetPtr = FCGetObj.PushObj <Text>(ret_obj);
            }
            break;

            default:
                break;
            }
            long ret_ptr = FCLibHelper.fc_get_return_ptr(L);
            FCLibHelper.fc_set_value_wrap_objptr(ret_ptr, nRetPtr);
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }
        return(0);
    }
        // Update is called once per frame
        void Update()
        {
            if (_animation == null)
            {
                _animation = (Animation)GetComponentInChildren <Animation>();
            }
            base.DoMovement();
            if (_animation == null)
            {
                return;
            }
            CharacterController controller = GetComponent <CharacterController>();

            //Debug.Log("Using animation for mob: " + name);
            if (dead && state != "spirit")
            {
                if (currentAnimation != deathAnimation)
                {
                    _animation.CrossFade(deathAnimation.name);
                }
                currentAnimation = deathAnimation;
            }
            else if (mount != null && mountAnimation != null)
            {
                _animation.CrossFade(mountAnimation.name);
            }
            else if (jumping)
            {
                if (!jumpingReachedApex)
                {
                    _animation[jumpPoseAnimation.name].speed    = jumpAnimationSpeed;
                    _animation[jumpPoseAnimation.name].wrapMode = WrapMode.ClampForever;
                    _animation.CrossFade(jumpPoseAnimation.name);
                }
                else
                {
                    _animation[jumpPoseAnimation.name].speed    = -landAnimationSpeed;
                    _animation[jumpPoseAnimation.name].wrapMode = WrapMode.ClampForever;
                    _animation.CrossFade(jumpPoseAnimation.name);
                }
            }
            else if (movementState == MOVEMENT_STATE_SWIMMING)
            {
                if (controller.velocity.sqrMagnitude > 0.1)
                {
                    _animation[swimAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0f, runMaxAnimationSpeed);
                    _animation.CrossFade(swimAnimation.name);
                }
                else
                {
                    _animation.CrossFade(swimIdleAnimation.name);
                }
            }
            else
            {
                if (controller.velocity.sqrMagnitude > 0.1)
                {
                    if (controller.velocity.magnitude > runThreshold)
                    {
                        _animation[runAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0f, runMaxAnimationSpeed);
                        _animation.CrossFade(runAnimation.name);
                    }
                    else
                    {
                        _animation[walkAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0f, walkMaxAnimationSpeed);
                        _animation.CrossFade(walkAnimation.name);
                    }
                }
                else if (overrideAnimation != null)
                {
                    //_animation [overrideAnimation.name].speed = Mathf.Clamp (controller.velocity.magnitude, 0.0f, runMaxAnimationSpeed);
                    _animation.CrossFade(overrideAnimation.name);
                    if (Time.time > overrideAnimationExpires)
                    {
                        overrideAnimation = null;
                    }
                }
                else
                {
                    _animation.CrossFade(idleAnimation.name);
                    currentAnimation = _animation.clip;
                }
            }


            if (isPlayer && controller.velocity.sqrMagnitude > 0.1 && ClientAPI.GetPlayerObject().PropertyExists("currentAnim"))
            {
                if ((string)ClientAPI.GetPlayerObject().GetProperty("currentAnim") != "null")
                {
                    NetworkAPI.SendTargetedCommand(ClientAPI.GetPlayerOid(), "/setStringProperty currentAnim null");
                }
            }
        }
Example #44
0
 public void Awake()
 {
     monsterid = gameObject.GetComponent <Animation>();
     kick      = gameObject.GetComponent <AudioSource>();
 }
Example #45
0
        public override void Update(int timeLastFrame)
        {
            base.Update(timeLastFrame);

            ModelComponent modelComponent = (ModelComponent)m_gameObject.GetComponent(typeof(ModelComponent).ToString());

            if (modelComponent == null)
            {
                Console.Out.WriteLine("No ModelComponent for Animator.");
                return;
            }

            Animation  animation  = modelComponent.Model.GetAnimation();
            QuadRender quadRender = (QuadRender)m_gameObject.GetComponent(typeof(QuadRender).ToString());

            float width_per_frame  = 1.0f / animation.m_tiltUV.X;
            float height_per_frame = 1.0f / animation.m_tiltUV.Y;

            if (m_isPlaying)
            {
                m_timeLastFrame += timeLastFrame;
            }

            if (m_timeLastFrame >= m_millionSecondPreFrame)
            {
                m_timeLastFrame -= m_millionSecondPreFrame;
                AnimationClip current_clip = animation.getAnimationClip(m_currentAnimationName);
                if (current_clip == null)
                {
                    Console.WriteLine("Error! Can not find animation clip: " + m_currentAnimationName);
                    return;
                }
                if (current_clip.m_mode == AnimationClip.PlayMode.PINGPONG)
                {
                    if (!m_isPong) // ping
                    {
                        if (m_currentIndex < current_clip.m_endIndex)
                        {
                            ++m_currentIndex;
                        }
                        else
                        {
                            --m_currentIndex;
                            m_isPong = true;
                        }
                    }
                    else
                    { // pong
                        if (m_currentIndex > current_clip.m_beginIndex)
                        {
                            --m_currentIndex;
                        }
                        else
                        {
                            ++m_currentIndex;
                            m_isPong = false;
                        }
                    }
                }
                else
                {
                    if (m_currentIndex < current_clip.m_endIndex)
                    {
                        ++m_currentIndex;
                    }
                    else
                    {
                        if (current_clip.m_mode == AnimationClip.PlayMode.CLAMP)
                        {
                            m_isPlaying.SetValue(false);
                        }
                        else if (current_clip.m_mode == AnimationClip.PlayMode.LOOP)
                        {
                            m_currentIndex = current_clip.m_beginIndex;
                        }
                        else if (current_clip.m_mode == AnimationClip.PlayMode.STOP)
                        {
                            m_currentIndex = current_clip.m_beginIndex;
                            m_isPlaying.SetValue(false);
                        }
                    }
                }
            }

            Point current_nxm = new Point();

            current_nxm.X = m_currentIndex % animation.m_tiltUV.X;
            current_nxm.Y = m_currentIndex / animation.m_tiltUV.X;

            quadRender.m_vertex[0].TextureCoordinate.X = current_nxm.X * width_per_frame;
            quadRender.m_vertex[0].TextureCoordinate.Y = (current_nxm.Y + 1) * height_per_frame;
            quadRender.m_vertex[1].TextureCoordinate.X = current_nxm.X * width_per_frame;
            quadRender.m_vertex[1].TextureCoordinate.Y = current_nxm.Y * height_per_frame;
            quadRender.m_vertex[2].TextureCoordinate.X = (current_nxm.X + 1) * width_per_frame;
            quadRender.m_vertex[2].TextureCoordinate.Y = (current_nxm.Y + 1) * height_per_frame;
            quadRender.m_vertex[3].TextureCoordinate.X = (current_nxm.X + 1) * width_per_frame;
            quadRender.m_vertex[3].TextureCoordinate.Y = current_nxm.Y * height_per_frame;
        }
 // Use this for initialization
 void Start()
 {
     _animation = (Animation)GetComponent("Animation");
 }
 // Token: 0x060002A9 RID: 681 RVA: 0x000345D8 File Offset: 0x000329D8
 private void Update() {
   if (!this.Clock.StopTime && this.EventCheck) {
     if (this.EventStudent[1] == null) {
       this.EventStudent[1] = this.StudentManager.Students[6];
     } else if (!this.EventStudent[1].Alive) {
       this.EventCheck = false;
       base.enabled = false;
     }
     if (this.EventStudent[2] == null) {
       this.EventStudent[2] = this.StudentManager.Students[7];
     } else if (!this.EventStudent[2].Alive) {
       this.EventCheck = false;
       base.enabled = false;
     }
     if (this.Clock.HourTime > 13.01f && this.EventStudent[1] != null && this.EventStudent[2] != null && this.EventStudent[1].Pathfinding.canMove && this.EventStudent[1].Pathfinding.canMove) {
       this.EventStudent[1].CurrentDestination = this.EventLocation[1];
       this.EventStudent[1].Pathfinding.target = this.EventLocation[1];
       this.EventStudent[1].EventManager = this;
       this.EventStudent[1].InEvent = true;
       this.EventStudent[2].CurrentDestination = this.EventLocation[2];
       this.EventStudent[2].Pathfinding.target = this.EventLocation[2];
       this.EventStudent[2].EventManager = this;
       this.EventStudent[2].InEvent = true;
       this.EventCheck = false;
       this.EventOn = true;
     }
   }
   if (this.EventOn) {
     float num = Vector3.Distance(this.Yandere.transform.position, this.EventStudent[this.EventSpeaker[this.EventPhase]].transform.position);
     if (this.Clock.HourTime > 13.5f || this.EventStudent[1].WitnessedCorpse || this.EventStudent[2].WitnessedCorpse || this.EventStudent[1].Dying || this.EventStudent[2].Dying || this.EventStudent[2].Splashed) {
       this.EndEvent();
     } else {
       if (!this.EventStudent[1].Pathfinding.canMove && !this.EventStudent[1].Private) {
         this.EventStudent[1].Character.GetComponent<Animation>().CrossFade(this.EventStudent[1].IdleAnim);
         this.EventStudent[1].Private = true;
         this.StudentManager.UpdateStudents();
       }
       if (!this.EventStudent[2].Pathfinding.canMove && !this.EventStudent[2].Private) {
         this.EventStudent[2].Character.GetComponent<Animation>().CrossFade(this.EventStudent[2].IdleAnim);
         this.EventStudent[2].Private = true;
         this.StudentManager.UpdateStudents();
       }
       if (!this.EventStudent[1].Pathfinding.canMove && !this.EventStudent[2].Pathfinding.canMove) {
         if (!this.InterruptZone.activeInHierarchy) {
           this.InterruptZone.SetActive(true);
         }
         if (!this.Spoken) {
           this.EventStudent[this.EventSpeaker[this.EventPhase]].Character.GetComponent<Animation>().CrossFade(this.EventAnim[this.EventPhase]);
           if (num < 10f) {
             this.EventSubtitle.text = this.EventSpeech[this.EventPhase];
           }
           AudioClipPlayer.Play(this.EventClip[this.EventPhase], this.EventStudent[this.EventSpeaker[this.EventPhase]].transform.position + Vector3.up * 1.5f, 5f, 10f, out this.VoiceClip, this.Yandere.transform.position.y);
           this.Spoken = true;
         } else {
           if (this.Yandere.transform.position.z > 0f) {
             this.Timer += Time.deltaTime;
             if (this.Timer > this.EventClip[this.EventPhase].length) {
               this.EventSubtitle.text = string.Empty;
             }
             if (this.Yandere.transform.position.y < this.EventStudent[1].transform.position.y - 1f) {
               this.EventSubtitle.transform.localScale = Vector3.zero;
             } else if (num < 10f) {
               this.Scale = Mathf.Abs((num - 10f) * 0.2f);
               if (this.Scale < 0f) {
                 this.Scale = 0f;
               }
               if (this.Scale > 1f) {
                 this.Scale = 1f;
               }
               this.EventSubtitle.transform.localScale = new Vector3(this.Scale, this.Scale, this.Scale);
             } else {
               this.EventSubtitle.transform.localScale = Vector3.zero;
             }
             Animation component = this.EventStudent[this.EventSpeaker[this.EventPhase]].Character.GetComponent<Animation>();
             if (component[this.EventAnim[this.EventPhase]].time >= component[this.EventAnim[this.EventPhase]].length) {
               component.CrossFade(this.EventStudent[this.EventSpeaker[this.EventPhase]].IdleAnim);
             }
             if (this.Timer > this.EventClip[this.EventPhase].length + 1f) {
               this.Spoken = false;
               this.EventPhase++;
               this.Timer = 0f;
               if (this.EventPhase == 4) {
                 if (!ConversationGlobals.GetTopicDiscovered(22)) {
                   this.Yandere.NotificationManager.DisplayNotification(NotificationType.Topic);
                   ConversationGlobals.SetTopicDiscovered(22, true);
                 }
                 if (!ConversationGlobals.GetTopicLearnedByStudent(22, 7)) {
                   this.Yandere.NotificationManager.DisplayNotification(NotificationType.Opinion);
                   ConversationGlobals.SetTopicLearnedByStudent(22, 7, true);
                 }
               }
               if (this.EventPhase == this.EventSpeech.Length) {
                 this.EndEvent();
               }
             }
           }
           if (this.Yandere.transform.position.y > this.EventStudent[1].transform.position.y - 1f && this.EventPhase == 7 && num < 5f && !EventGlobals.Event1) {
             this.Yandere.NotificationManager.DisplayNotification(NotificationType.Info);
             EventGlobals.Event1 = true;
           }
         }
       }
     }
   }
 }
 private void Start()
 {
     _shieldAnimation = GetComponentInChildren <Animation>();
 }
Example #49
0
    void FixedUpdate()
    {
        character = GameObject.FindGameObjectWithTag("character");
        anim      = character.GetComponent <Animation>();
        protag    = GameObject.FindGameObjectWithTag("Player");


        if (character.name == "Ruth2")
        {
            GameObject tornadoSide  = GameObject.Find("bag tornado side moveLeft");
            GameObject tornadoSide2 = GameObject.Find("bag tornado side moveRight");
            tornadoSpriteLeft  = tornadoSide.GetComponent <SpriteRenderer>();
            tornadoSpriteRight = tornadoSide2.GetComponent <SpriteRenderer>();
        }
        else if (character.name == "Char")
        {
            PropScript         = protag.GetComponent <boostProp>();
            garySwipeLeftProp  = PropScript.swipeLeftProp;
            garySwipeRightProp = PropScript.swipeRightProp;
        }
        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
        {
            // Get movement of the finger since last frame

            Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;

            // Move object across XY plane

            if (touchDeltaPosition.x > 1 && swipeCap >= 1 && Time.timeScale == 1f && protag.GetComponent <Rigidbody>().velocity == Vector3.zero)
            {
                if (character.name == "Ruth2")
                {
                    anim["shopper_moveright_anim"].speed = 2.0f;
                }
                //SwipeRight
                if (currentLane == "Lane2" && garySwiped == false)
                {
                    targetPosition = target3.transform.position;
                    playSwipeRightAnimations();
                }
                else if (currentLane == "Lane1" && garySwiped == false)
                {
                    targetPosition = target2.transform.position;
                    playSwipeRightAnimations();
                }
            }
            else if (touchDeltaPosition.x < -1 && swipeCap >= 1 && Time.timeScale == 1f && protag.GetComponent <Rigidbody>().velocity == Vector3.zero)
            {
                if (character.name == "Ruth2")
                {
                    anim["shopper_moveleft_anim"].speed = 2.0f;
                }
                //SwipeLeft
                if (currentLane == "Lane2" && garySwiped == false)
                {
                    targetPosition = target1.transform.position;
                    playSwipeLeftAnimations();
                }
                else if (currentLane == "Lane3" && garySwiped == false)
                {
                    targetPosition = target2.transform.position;
                    playSwipeLeftAnimations();
                }
            }
            else
            {
                AudioSource insufficientSwipe = GameObject.Find("sfxInsufficientSwipe").GetComponent <AudioSource>();
                insufficientSwipe.Play();
            }
            if (character.name == "Ruth2")
            {
                Invoke("disableTornadoSprite", 0.5f);
            }
        }

        if (isGameOver == false)
        {
            MovePlayer();
        }
    }
Example #50
0
        public void Init()
        {
            this._basePosition = new Vector3[]
            {
                new Vector3(101f, -481f, 0f),
                new Vector3(38f, -533f, 0f),
                new Vector3(105f, -419f, 0f),
                new Vector3(-39f, -581f, 0f),
                new Vector3(110f, -362f, 0f),
                new Vector3(-120f, -634f, 0f)
            };
            this._baseNum = new int[]
            {
                2,
                3,
                1,
                4,
                0,
                5
            };
            float num = 0.8f + 0.1f * (float)this._baseNum[this._shipNum];

            base.get_transform().set_localPosition(this._basePosition[this._shipNum]);
            base.get_transform().set_localScale(new Vector3(num, num, num));
            GameObject gameObject = base.get_transform().FindChild("AircraftObj").get_gameObject();

            Util.FindParentToChild <UITexture>(ref this._uiAircraft, gameObject.get_transform(), "Aircraft");
            Util.FindParentToChild <ParticleSystem>(ref this._explosionParticle, this._uiAircraft.get_transform(), "AircraftExplosion");
            Util.FindParentToChild <ParticleSystem>(ref this._smokeParticle, this._uiAircraft.get_transform(), "AircraftSmoke");
            this._uiAircraft.depth = 5 + this._baseNum[this._shipNum];
            if (this._anime == null)
            {
                this._anime = this._uiAircraft.GetComponent <Animation>().GetComponent <Animation>();
            }
            if (this._fleetType == FleetType.Friend)
            {
                this._uiAircraft.flip        = UIBasicSprite.Flip.Nothing;
                this._uiAircraft.mainTexture = SingletonMonoBehaviour <ResourceManager> .Instance.SlotItemTexture.Load(this._plane.MstId, 6);

                this._uiAircraft.get_transform().set_localScale(Vector3.get_one());
            }
            else if (this._fleetType == FleetType.Enemy)
            {
                this._uiAircraft.flip = UIBasicSprite.Flip.Nothing;
                if (BattleTaskManager.GetBattleManager() is PracticeBattleManager)
                {
                    this._uiAircraft.flip        = UIBasicSprite.Flip.Horizontally;
                    this._uiAircraft.mainTexture = SingletonMonoBehaviour <ResourceManager> .Instance.SlotItemTexture.Load(this._plane.MstId, 6);

                    this._uiAircraft.get_transform().set_localScale(Vector3.get_one());
                }
                else
                {
                    this._uiAircraft.mainTexture = SlotItemUtils.LoadTexture(this._plane);
                    this._uiAircraft.MakePixelPerfect();
                    this._uiAircraft.get_transform().set_localScale((this._plane.MstId > 500) ? new Vector3(0.7f, 0.7f, 0.7f) : new Vector3(0.8f, 0.8f, 0.8f));
                }
            }
            Vector3 to = new Vector3(this._basePosition[this._shipNum].x, this._basePosition[this._shipNum].y + 544f, this._basePosition[this._shipNum].z);

            base.get_transform().LTMoveLocal(to, 0.8f).setEase(LeanTweenType.easeOutBack).setDelay(0.4f + 0.1f * (float)this._baseNum[this._shipNum]);
        }
Example #51
0
        public Bullet(BulletInfo info, ProjectileArgs args)
        {
            this.info = info;
            this.args = args;
            pos       = args.Source;
            source    = args.Source;

            var world = args.SourceActor.World;

            if (info.LaunchAngle.Length > 1)
            {
                angle = new WAngle(world.SharedRandom.Next(info.LaunchAngle[0].Angle, info.LaunchAngle[1].Angle));
            }
            else
            {
                angle = info.LaunchAngle[0];
            }

            if (info.Speed.Length > 1)
            {
                speed = new WDist(world.SharedRandom.Next(info.Speed[0].Length, info.Speed[1].Length));
            }
            else
            {
                speed = info.Speed[0];
            }

            target = args.PassiveTarget;
            if (info.Inaccuracy.Length > 0)
            {
                var maxInaccuracyOffset = Util.GetProjectileInaccuracy(info.Inaccuracy.Length, info.InaccuracyType, args);
                target += WVec.FromPDF(world.SharedRandom, 2) * maxInaccuracyOffset / 1024;
            }

            if (info.AirburstAltitude > WDist.Zero)
            {
                target += new WVec(WDist.Zero, WDist.Zero, info.AirburstAltitude);
            }

            facing = (target - pos).Yaw;
            length = Math.Max((target - pos).Length / speed.Length, 1);

            if (!string.IsNullOrEmpty(info.Image))
            {
                anim = new Animation(world, info.Image, new Func <WAngle>(GetEffectiveFacing));
                anim.PlayRepeating(info.Sequences.Random(world.SharedRandom));
            }

            if (info.ContrailLength > 0)
            {
                var color = info.ContrailUsePlayerColor ? ContrailRenderable.ChooseColor(args.SourceActor) : info.ContrailColor;
                contrail = new ContrailRenderable(world, color, info.ContrailWidth, info.ContrailLength, info.ContrailDelay, info.ContrailZOffset);
            }

            trailPalette = info.TrailPalette;
            if (info.TrailUsePlayerPalette)
            {
                trailPalette += args.SourceActor.Owner.InternalName;
            }

            smokeTicks       = info.TrailDelay;
            remainingBounces = info.BounceCount;

            shadowColor = new float3(info.ShadowColor.R, info.ShadowColor.G, info.ShadowColor.B) / 255f;
            shadowAlpha = info.ShadowColor.A / 255f;
        }
Example #52
0
 public bool Write(Animation anim, Stream output, object[] data)
 {
     return(false);
 }
        public override void OnStart(PartModule.StartState state)
        {
            String[] resources_to_supply = { FNResourceManager.FNRESOURCE_MEGAJOULES, FNResourceManager.FNRESOURCE_WASTEHEAT, FNResourceManager.FNRESOURCE_THERMALPOWER };
            this.resources_to_supply = resources_to_supply;
            base.OnStart(state);
            if (state == StartState.Editor)
            {
                return;
            }

            if (part.FindModulesImplementing <MicrowavePowerTransmitter>().Count == 1)
            {
                part_transmitter = part.FindModulesImplementing <MicrowavePowerTransmitter>().First();
                has_transmitter  = true;
            }

            if (animTName != null)
            {
                animT = part.FindModelAnimators(animTName).FirstOrDefault();
                if (animT != null)
                {
                    animT[animTName].layer          = 1;
                    animT[animTName].normalizedTime = 0f;
                    animT[animTName].speed          = 0.001f;
                    animT.Play();
                }
            }

            if (animName != null)
            {
                anim = part.FindModelAnimators(animName).FirstOrDefault();
                if (anim != null)
                {
                    anim[animName].layer = 1;
                    if (connectedsatsi > 0 || connectedrelaysi > 0)
                    {
                        anim[animName].normalizedTime = 1f;
                        anim[animName].speed          = -1f;
                    }
                    else
                    {
                        anim[animName].normalizedTime = 0f;
                        anim[animName].speed          = 1f;
                    }
                    anim.Play();
                }
            }
            vmps = new List <VesselMicrowavePersistence>();
            vrps = new List <VesselRelayPersistence>();
            foreach (Vessel vess in FlightGlobals.Vessels)
            {
                String vesselID = vess.id.ToString();

                if (vess.isActiveVessel == false && vess.vesselName.ToLower().IndexOf("debris") == -1)
                {
                    ConfigNode config = PluginHelper.getPluginSaveFile();
                    if (config.HasNode("VESSEL_MICROWAVE_POWER_" + vesselID))
                    {
                        ConfigNode power_node    = config.GetNode("VESSEL_MICROWAVE_POWER_" + vesselID);
                        double     nuclear_power = 0;
                        double     solar_power   = 0;
                        if (power_node.HasValue("nuclear_power"))
                        {
                            nuclear_power = double.Parse(power_node.GetValue("nuclear_power"));
                        }
                        if (power_node.HasValue("solar_power"))
                        {
                            solar_power = double.Parse(power_node.GetValue("solar_power"));
                        }
                        if (nuclear_power > 0 || solar_power > 0)
                        {
                            VesselMicrowavePersistence vmp = new VesselMicrowavePersistence(vess);
                            vmp.setSolarPower(solar_power);
                            vmp.setNuclearPower(nuclear_power);
                            vmps.Add(vmp);
                        }
                    }

                    if (config.HasNode("VESSEL_MICROWAVE_RELAY_" + vesselID))
                    {
                        ConfigNode relay_node = config.GetNode("VESSEL_MICROWAVE_RELAY_" + vesselID);
                        if (relay_node.HasValue("relay"))
                        {
                            bool relay = bool.Parse(relay_node.GetValue("relay"));
                            if (relay)
                            {
                                VesselRelayPersistence vrp = new VesselRelayPersistence(vess);
                                vrp.setActive(relay);
                                vrps.Add(vrp);
                            }
                        }
                    }
                }
            }
            penaltyFreeDistance = Math.Sqrt(1 / ((microwaveAngleTan * microwaveAngleTan) / collectorArea));

            this.part.force_activate();
        }
Example #54
0
 private void Awake()
 {
     anim = GetComponentInChildren <Animation>();
 }
Example #55
0
 private void Awake()
 {
     playerAnimation = gameObject.GetComponent <Animation>();
 }
Example #56
0
        private void SfPopUp_PopupOpened(object sender, EventArgs e)
        {
            sfPopUp.PopupView.AnimationMode = AnimationMode.None;
            try
            {
                if (clickCount == 0)
                {
                    anim             = new TranslateAnimation(sfPopUp.GetX(), sfPopUp.GetX(), sfPopUp.GetY(), sfPopUp.GetY() + 30);
                    anim.Duration    = 500; //You can manage the time of the blink with this parameter
                    anim.RepeatMode  = RepeatMode.Reverse;
                    anim.RepeatCount = int.MaxValue;
                    sfPopUp.PopupView.StartAnimation(anim);
                }
                else if (clickCount == 1)
                {
                    sfPopUp.PopupView.ClearAnimation();
                    anim             = new TranslateAnimation(popupLayoutpoint.X, popupLayoutpoint.X + (50 * density), popupLayoutpoint.Y, popupLayoutpoint.Y);
                    anim.Duration    = 2000; //You can manage the time of the blink with this parameter
                    anim.RepeatMode  = RepeatMode.Restart;
                    anim.RepeatCount = int.MaxValue;
                    sfPopUp.PopupView.StartAnimation(anim);
                }
                else if (clickCount == 2)
                {
                    sfPopUp.PopupView.ClearAnimation();
                    anim             = new AlphaAnimation(0.0f, 1.0f);
                    anim.Duration    = 250;
                    anim.RepeatCount = 1; //You can manage the time of the blink with this parameter
                    anim.RepeatMode  = RepeatMode.Restart;
                    sfPopUp.PopupView.StartAnimation(anim);
                    anim.AnimationEnd += async(s, ev) =>
                    {
                        await Task.Delay(1000);

                        if (!pageExited)
                        {
                            sfPopUp.PopupView.StartAnimation(anim);
                        }
                    };
                }
                else if (clickCount == 3)
                {
                    sfPopUp.PopupView.ClearAnimation();
                    anim             = null;
                    anim             = new TranslateAnimation(popupLayoutpoint.X / density, (popupLayoutpoint.X / density) + 50 * density, popupLayoutpoint.Y / density, popupLayoutpoint.Y / density);
                    anim.Duration    = 2000;
                    anim.RepeatCount = int.MaxValue; //You can manage the time of the blink with this parameter
                    anim.RepeatMode  = RepeatMode.Restart;
                    sfPopUp.PopupView.StartAnimation(anim);
                }
                else if (clickCount == 4)
                {
                    DrawArc test;
                    sfPopUp.PopupView.ClearAnimation();
                    anim = null;
                    var handSymbol = (sfPopUp.PopupView.ContentView as RelativeLayout).GetChildAt(1);
                    if (MainActivity.IsTablet)
                    {
                        test = new DrawArc(2000, 1, -10, 1, 150, 1, -100);
                    }
                    else
                    {
                        test = new DrawArc(2000, 1, -50, 1, 350, 1, -300);
                    }
                    test.RepeatCount = int.MaxValue; //You can manage the time of the blink with this parameter
                    test.RepeatMode  = RepeatMode.Restart;
                    handSymbol.StartAnimation(test);
                }
            }
            catch
            {
            }
        }
Example #57
0
 public override Widget buildPage(BuildContext context, Animation <float> animation,
                                  Animation <float> secondaryAnimation)
 {
     return(this.pageBuilder(context, animation, secondaryAnimation));
 }
Example #58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Theme" /> class.
 /// </summary>
 public Theme()
 {
     AvaloniaXamlLoader.Load(this);
     Animation.RegisterAnimator <RelativePointAnimator>(property => typeof(RelativePoint).IsAssignableFrom(property.PropertyType));
 }
Example #59
0
        private IEnumerator RunAnimation(Animation animation)
        {
#if CONSOLE_BATTLE_DEBUGGING
            if (animation.type == Animation.Type.Text)
            {
                foreach (string message in animation.messages)
                {
                    Debug.Log(message);
                }
                yield break;
            }
#endif

            switch (animation.type)
            {
            case Animation.Type.Text:
                yield return(StartCoroutine(RunAnimation_Text(animation)));

                break;

            case Animation.Type.PlayerRetract:
                yield return(StartCoroutine(battleLayoutController.RetractPlayerPokemon()));

                break;

            case Animation.Type.OpponentRetract:
                yield return(StartCoroutine(battleLayoutController.RetractOpponentPokemon()));

                break;

            case Animation.Type.PlayerSendOut:
                yield return(StartCoroutine(battleLayoutController.SendInPlayerPokemon(animation.sendOutPokemon, animation.participantPokemonStates)));

                break;

            case Animation.Type.OpponentSendOutWild:
                yield return(StartCoroutine(battleLayoutController.SendInWildOpponentPokemon(animation.sendOutPokemon)));

                break;

            case Animation.Type.OpponentSendOutTrainer:
                yield return(StartCoroutine(battleLayoutController.SendInTrainerOpponentPokemon(animation.sendOutPokemon, animation.participantPokemonStates)));

                break;

            case Animation.Type.PlayerTakeDamage:
                yield return(StartCoroutine(battleLayoutController.TakeDamagePlayerPokemon(
                                                animation.takeDamageNewHealth,
                                                animation.takeDamageOldHealth,
                                                animation.takeDamageMaxHealth
                                                )));

                break;

            case Animation.Type.OpponentTakeDamage:
                yield return(StartCoroutine(battleLayoutController.TakeDamageOpponentPokemon(
                                                animation.takeDamageNewHealth,
                                                animation.takeDamageOldHealth,
                                                animation.takeDamageMaxHealth
                                                )));

                break;

            case Animation.Type.PlayerHealHealth:
                yield return(StartCoroutine(battleLayoutController.HealHealthPlayerPokmeon(
                                                animation.takeDamageNewHealth,
                                                animation.takeDamageOldHealth,
                                                animation.takeDamageMaxHealth
                                                )));

                break;

            case Animation.Type.OpponentHealHealth:
                yield return(StartCoroutine(battleLayoutController.HealHealthOpponentPokmeon(
                                                animation.takeDamageNewHealth,
                                                animation.takeDamageOldHealth,
                                                animation.takeDamageMaxHealth
                                                )));

                break;

            case Animation.Type.PlayerPokemonExperienceGain:
                yield return(StartCoroutine(battleLayoutController.IncreasePlayerPokemonExperience(
                                                animation.experienceGainInitialExperience,
                                                animation.experienceGainNewExperience,
                                                animation.experienceGainGrowthType
                                                )));

                break;

            case Animation.Type.PokemonMove:
                yield return(StartCoroutine(RunAnimation_PokemonMove(animation)));

                break;

            case Animation.Type.PlayerStatModifierUp:
                yield return(StartCoroutine(battleLayoutController.PlayerStatStageChange(true)));

                break;

            case Animation.Type.PlayerStatModifierDown:
                yield return(StartCoroutine(battleLayoutController.PlayerStatStageChange(false)));

                break;

            case Animation.Type.OpponentStatModifierUp:
                yield return(StartCoroutine(battleLayoutController.OpponentStatStageChange(true)));

                break;

            case Animation.Type.OpponentStatModifierDown:
                yield return(StartCoroutine(battleLayoutController.OpponentStatStageChange(false)));

                break;

            case Animation.Type.OpponentTrainerShowcaseStart:
                yield return(StartCoroutine(battleLayoutController.OpponentTrainerShowcaseStart(animation.opponentTrainerShowcaseSprite)));

                break;

            case Animation.Type.OpponentTrainerShowcaseStop:
                yield return(StartCoroutine(battleLayoutController.OpponentTrainerShowcaseStop()));

                break;

            case Animation.Type.PokeBallUse:
                yield return(StartCoroutine(battleLayoutController.PokeBallUse(animation.pokeBallUsePokeBall, animation.pokeBallUseWobbleCount, animation.speciesId)));

                break;

            case Animation.Type.PokemonSemiInvulnerableStart:
                yield return(StartCoroutine(battleLayoutController.PokemonSemiInvunlerableStart(animation.pokemonSemiInvulnerableParticipantIsPlayer)));

                break;

            case Animation.Type.PokemonSemiInvulnerableStop:
                yield return(StartCoroutine(battleLayoutController.PokemonSemiInvunlerableStop(animation.pokemonSemiInvulnerableParticipantIsPlayer)));

                break;

            case Animation.Type.WeatherDisplay:

                Weather weather = Weather.GetWeatherById(animation.weatherDisplayTargetWeatherId);

                // Announcement
                if (weather.announcement != null)
                {
                    yield return(StartCoroutine(RunAnimation(new Animation()
                    {
                        type = Animation.Type.Text,
                        messages = new string[1] {
                            weather.announcement
                        },
                        requireUserContinue = false
                    })));
                }

                // Animation
                yield return(StartCoroutine(battleLayoutController.WeatherDisplay(weather)));

                break;
            }
        }
Example #60
0
 // Use this for initialization
 void Start()
 {
     rb   = GetComponent <Rigidbody> ();
     anim = GetComponent <Animation> ();
 }