SetBool() public method

public SetBool ( int id, bool value ) : void
id int
value bool
return void
コード例 #1
2
ファイル: DragonAnimator.cs プロジェクト: jlonardi/igp-DnM
 void Start()
 {
     animator = GetComponent<Animator>();
     dragon = GetComponent<Dragon>();
     animator.SetBool("Flying",false);
     animator.SetBool("Breath Fire", false);
 }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     melt_.SetBool("IsMelt", false);
     fire_.SetBool("isFire", false);
     uiManager    = GameObject.Find("UILayer").GetComponent <UIManager>();
     soundManager = GameObject.Find("EverySceneNeed").GetComponent <SoundManager>();
 }
コード例 #3
0
ファイル: Iddle.cs プロジェクト: MaturuturuStudios/Drop
    private void CheckTimeIddle(Animator animator)
    {
        if (commonParameters.walking) {
            //if enemy walk, check the timer
            _deltaTime -= Time.deltaTime;
            if (_deltaTime <= 0) {
                animator.SetBool("Timer", true);
            }

            //but if only one path...
            if (commonParameters.AI.walkingParameters.usePath && commonParameters.AI.walkingParameters.path.points.Length<=1) {
                commonParameters.walking = false;
            }

        } else {

            //if the enemy is not walking but not in its position, go to walking
            Vector3 target = commonParameters.initialPositionEnemy;
            Quaternion rotationTarget = commonParameters.initialRotationEnemy;

            if (!AIMethods.CheckTargetPoint(commonParameters.enemy, target, commonParameters.onFloor, commonParameters.minimumWalkingDistance)) {
                animator.SetBool("Timer", true);
            }

            if (!AIMethods.CheckTargetRotation(commonParameters.enemy, rotationTarget, commonParameters.toleranceDegreeToGoal)) {
                animator.SetBool("Timer", true);
            }

        }
    }
コード例 #4
0
	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}

	// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
	override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
		animator.SetBool ("lowTrip", false);
		// In case the animation ends early, we must avoid input holds
		this.active = false;
		animator.SetBool ("inAnimation", false);

	}
コード例 #5
0
ファイル: AttackingEnemy.cs プロジェクト: dunbarj/Firates
 // Use this for initialization
 void Awake()
 {
     rb2d = GetComponent<Rigidbody2D> ();
     anim = GetComponent<Animator> ();
     anim.SetBool ("surprised", false);
     anim.SetBool ("facingRight", false);
 }
コード例 #6
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.gameObject.tag == "Shot"){
            if(other.transform.position.x < Lion.transform.position.x)
                Lion.rigidbody2D.AddForce( new Vector2(hit_power, 0));
            else
                Lion.rigidbody2D.AddForce( new Vector2( -1 * hit_power, 0));

            Lion_Script.HP -= 1;
            BHScript.currenthealth -= 1;
            Lion.audio.PlayOneShot (lionroar);
            Lion_Script.fleeing = true;

            Lion_Script.flee_time += flee_increase;

            gameObject.active = false;

            if(Lion_Script.HP <=0){
             anim =	Lion.GetComponent<Animator>();
            anim.SetBool ("roarState", false);
            anim.SetBool("deathState", true);
            anim.SetBool("permaState", true);
                Lion_Script.enabled = false;
            }
            Destroy(other.gameObject);
                }
    }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     fire_.SetBool("isFire", false);
     barrier      = GameObject.Find("Barrier2");
     uiManager    = GameObject.Find("UILayer").GetComponent <UIManager>();
     soundManager = GameObject.Find("EverySceneNeed").GetComponent <SoundManager>();
 }
コード例 #8
0
    // On scene load, do this...
    void Start() {


        leftArmNode  = transform.Find(leftArmNodeName).GetComponent<PickupNode>();
        rightArmNode = transform.Find(rightArmNodeName).GetComponent<PickupNode>();

        
        leftArmNode.setPosition(transform.Find(leftArmNodeName));
        rightArmNode.setPosition(transform.Find(rightArmNodeName));

        leftArmPosition  = "North";
        rightArmPosition = "North";

		float old_ly = leftArmNode.getTransform().localPosition.y;
		leftArmNode.getTransform().localPosition = new Vector3(-0.3f, old_ly, 1.0f);

		float old_ry = rightArmNode.getTransform().localPosition.y;
		rightArmNode.getTransform().localPosition = new Vector3(0.3f, old_ry, 1.0f);

        animate = GetComponent<Animator>();
		itemManager = GetComponent<PlayerItemManager> ();

		animate.SetBool("LF", LF);
		animate.SetBool("RF", RF);

        // NOTE: 
        //      "Node Position" is really only the coordinates of game objects called
        // "Left Arm Node", "Right Arm Node" and such. The Nodes themselves are a part
        // of this own manager's abstract class.
        //
        //      In other words, no properties are ever allocated to those node objects in the
        // game space. They are only the points at which
    }
コード例 #9
0
ファイル: AnimatorExtension.cs プロジェクト: rgebauer/snail
        public static bool TriggerExists(this UnityEngine.Animator animator, string triggerName)
        {
            if (!animator)
            {
                return(false);
            }

            animator.logWarnings = false;

            bool origVal = animator.GetBool(triggerName);

            animator.SetBool(triggerName, true);
            if (!animator.GetBool(triggerName))
            {
                return(false);
            }
            animator.SetBool(triggerName, false);
            if (animator.GetBool(triggerName))
            {
                return(false);
            }

            animator.SetBool(triggerName, origVal);
            return(true);
        }
コード例 #10
0
ファイル: NewLever.cs プロジェクト: GikeyMe/2D-Platformer
    // Use this for initialization
    void Start () {
        LeverAnimator = GetComponent<Animator>();

        if (PlayerPrefsX.GetBool("LeverLoading"))
        {
            if (gameObject.name == "LeftLever")
            {
                LeverAnimator.SetBool("Pulled", PlayerPrefsX.GetBool("LeftLeverPulled"));
                PlayerPrefsX.SetBool("LeftLeverDealtWith", true);
            }
            if (gameObject.name == "RightLever")
            {
                LeverAnimator.SetBool("Pulled", PlayerPrefsX.GetBool("RightLeverPulled"));
                PlayerPrefsX.SetBool("RightLeverDealtWith", true);
            }

            if (PlayerPrefsX.GetBool("LeftLeverDealtWith") && PlayerPrefsX.GetBool("RightLeverDealtWith"))
            {
                PlayerPrefsX.SetBool("LeverLoading", false); //this line is what is causing the issues with the left lever
                PlayerPrefsX.SetBool("LeftLeverDealtWith", false);
                PlayerPrefsX.SetBool("RightLeverDealtWith", false);
            }
        }


    }
コード例 #11
0
ファイル: Character.cs プロジェクト: Qawery/Polyjam2014
	// Use this for initialization
	void Start ()
	{
        playerHP = maxPlayerHP;

		//ustawienie wizje na latarke
		visionALongLight.enabled = true;
		visionAShortLight.enabled = true;
		visionBLight.enabled = false;
		visionBTopLight.enabled = false;
		visionCLight.enabled = false;

        mainCamera_ = GameObject.Find("Main Camera"); 
        animator_ = GameObject.Find("laska").GetComponent<Animator>();

        //animator_ = 

        //animator_cycki = GameObject.Find("laska_cycki").GetComponent<Animator>();
        //animator_nogi = GameObject.Find("laska_nogi").GetComponent<Animator>(); 

        animator_.SetBool("isWalking", false);
        animator_.SetBool("isShooting", false);
        animator_.SetBool("isAttacked", false);
        animator_.SetBool("isDying", false);
        
        //animator_cycki.SetBool("isWalking", false);
        //animator_cycki.SetBool("isShooting", false);
        //animator_cycki.SetBool("isDying", false);

        //animator_nogi.SetBool("isWalking", false);
        //animator_nogi.SetBool("isShooting", false);
        //animator_nogi.SetBool("isDying", false); 
	}
コード例 #12
0
ファイル: player.cs プロジェクト: jspezia/Unity
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && _weaponSelected != null) {
            AudioSource.PlayClipAtPoint(fire, Vector3.up);
        }
        if (Input.GetKeyDown(KeyCode.E) && _weaponSelected == null) {
            _colSelected = Physics2D.OverlapPoint(transform.position);
            if (_colSelected && _colSelected.tag == "weapon") {
                AudioSource.PlayClipAtPoint(reload, Vector3.up);
                _weaponSelected = _colSelected.gameObject.GetComponent<generateWeapon>();
                anim = _weaponSelected.GetComponent<Animator>();
                _weapon = _weaponSelected.weapon.GetComponent<weapons>();
                attachToBody.GetComponent<SpriteRenderer>().sprite = _weapon.attachToBody;
                weapon2 = weapon.GetComponent<weapon>();
                bullet_prefab = weapon.GetComponent<weapon>().bullet_prefab;
                bullet_prefab.GetComponent<SpriteRenderer>().sprite = weapon2.bullets[_weaponSelected.i];

                _weaponSelected.transform.localScale = Vector3.zero;

                anim.SetBool("isTake", true);
                anim.SetBool("isDrop", false);

            }
        }

        if (Input.GetMouseButtonDown (1) && _weaponSelected != null) {
            anim.SetBool("isTake", false);
            anim.SetBool("isDrop", true);
            _weaponSelected.transform.position = transform.position;
            attachToBody.GetComponent<SpriteRenderer>().sprite = null;

            _weaponSelected = null;
        }
    }
コード例 #13
0
    void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.isWriting)
        {
            // We own this player: send the others our data
            stream.SendNext(transform.position);
            stream.SendNext(transform.rotation);
            anim = GetComponent< Animator >();
            stream.SendNext(anim.GetFloat("Speed"));
            stream.SendNext(anim.GetFloat("Direction"));
            stream.SendNext(anim.GetBool("Punch_L"));
            stream.SendNext(anim.GetBool("LowKick"));
            stream.SendNext(anim.GetBool("HiKick"));
            stream.SendNext(anim.GetBool("Shoryuken"));

            myThirdPersonController myC = GetComponent<myThirdPersonController>();
            stream.SendNext((int)myC._characterState);
        }
        else
        {
            // Network player, receive data
            this.correctPlayerPos = (Vector3)stream.ReceiveNext();
            this.correctPlayerRot = (Quaternion)stream.ReceiveNext();
            anim = GetComponent< Animator >();
            anim.SetFloat("Speed",(float)stream.ReceiveNext());
            anim.SetFloat("Direction",(float)stream.ReceiveNext());
            anim.SetBool("Punch_L",(bool)stream.ReceiveNext());
            anim.SetBool("LowKick",(bool)stream.ReceiveNext());
            anim.SetBool("HiKick", (bool)stream.ReceiveNext());
            anim.SetBool("Shoryuken", (bool)stream.ReceiveNext());

            myThirdPersonController myC = GetComponent<myThirdPersonController>();
            myC._characterState = (CharacterState)stream.ReceiveNext();
        }
    }
コード例 #14
0
    public void initVariables(Character currChar, string side, string itemName1)
    {
        character = currChar;
        animator = character.GetComponent<Animator> ();
        itemName = itemName1;

        targetRightHouse = new Vector3 (16.5f, 0.45f, -6.0f);
        targetLeftHouse = new Vector3 (12.0f, 0.45f, -6.0f);
        targetLeftItemDrop = new Vector3 (14.0f, 0.45f, -6.0f);
        targetRightItemDrop = new Vector3 (15.4f, 0.45f, -6.0f);

        //updateAnimationPoints ();
        animator.SetBool ("insideHouse", true);

        if (side.Contains ("left") && itemName.Contains ("none")) {
            leftToRight = true;
        } else if (side.Contains ("right") && itemName.Contains ("none")) {
            rightToLeft = true;
        } else if (side.Contains ("left")) {
            leftToRightBindle = true;
            animator.SetBool ("bindle", true);
        } else if (side.Contains ("right")) {
            rightToLeftBinle = true;
            animator.SetBool ("bindle", true);
        }
        isInit = true;
    }
コード例 #15
0
ファイル: WarriorAttack.cs プロジェクト: NEOF/TDUnity
    // basic melee attack which just deals damage and runs animation. простая атака ближнего боя которая наносит урон и проигрывает анимацию
    public void basicMelee()
    {
        this.towerManager.isphysDmg=true;
        this.towerManager.ismageDmg=false;
        if(attackAreaMeleeEnter.enemy!=null) // check if there is something in front of the tower.  проверить есть ли какой-то объект перед башней.
        {
            if(attackAreaMeleeEnter.enemy.gameObject.tag.Contains("Enemy")) //check if thing in front of tower is actually an enemy. проверить если этот объект с тегом враг
            {
                hp = attackAreaMeleeEnter.enemy.gameObject.GetComponent("Health") as Health; // get health component of an enemy. берем компонент health из объекта врага
                animator = this.GetComponent<Animator>();// animator

                // attack with cooldown of two seconds and play animation. атакует с интервалом в две секунды и играет анимацию.
                if (timeStamp<=Time.time)
                {
                    hp.getDamage(damage);
                    timeStamp=Time.time+2.0f;
                    animator.SetBool("Attack",false);
                }

                // if enemy is dead, destroy enemy object. если враг мертв, уничтожаем его объект и ставим idle анимацию.
                if (hp.isDead())
                {
                    Destroy(attackAreaMeleeEnter.enemy.gameObject);
                    animator.SetBool("Attack",true);
                }
            }
        }
    }
コード例 #16
0
ファイル: CloseBool.cs プロジェクト: newhandfun/WOBAgithub
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (A)
         animator.SetBool (AnimParameter.A,false);
     if (S)
         animator.SetBool (AnimParameter.S,false);
 }
コード例 #17
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false; // temporarily set to true for testing

        eyes = this.transform.Find("Eyes").gameObject;
        body = this.transform.Find("geckstronautAnimatedWithGun").gameObject;

        startPosition = this.transform.position; // this will be the place the player responds to each time he dies
        eyesStartPos = eyes.transform.position;
        bodyStartPos = body.transform.position;

        startRot = this.transform.rotation;
        eyesStartRot = eyes.transform.rotation;
        bodyStartRot = body.transform.rotation;

        characterController = GetComponent<CharacterController>();
        
		firstPersonCamera = this.GetComponentInChildren<Camera>();

        geckAnimator = this.transform.Find("geckstronautAnimatedWithGun").GetComponent<Animator>();
        geckAnimator.SetBool("HasGun", false);
        geckAnimator.SetBool("Idle", false);
        geckAnimator.SetBool("Walking", false);
        geckAnimator.SetBool("Running", false);
        geckAnimator.SetBool("Shooting", false);

        manager = GameObject.FindGameObjectWithTag("GameController");
		mouseSensitivity = PlayerPrefs.GetFloat ("Mouse Sensitivity");
			//manager.GetComponent<GameManagerScript>().mouseSensitivity; // get mouse sensitivity from GameController object

		//if (isLocalPlayer) {
		//	this.GetComponentInChildren<Camera>().enabled = true;
		//	this.GetComponentInChildren<AudioListener>().enabled = true;
		//}
    }
コード例 #18
0
ファイル: Secondui.cs プロジェクト: corefan/uLui
    void Start() {

        wm = LSingleton.getInstance("LWindowManager") as LWindowManager;
        teddyAnim = GameObject.Find("Teddy").GetComponent<Animator>();

        btn_msg.onClick.AddListener(() =>
        {
            wm.runWindow("MsgBox", typeof(MsgBox), WindowHierarchy.Normal);
        });

        btn_trans.onClick.AddListener(() =>
        {
            Application.LoadLevel("first");
        });

        btn_anim.onClick.AddListener(() =>
        {
            teddyAnim.SetBool("run_idle", false);
            teddyAnim.SetBool("idle_run", true);
        });

        btn_clean.onClick.AddListener(() =>
        {
            teddyAnim.SetBool("idle_run", false);
            teddyAnim.SetBool("run_idle", true);
        });
	}
コード例 #19
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 //OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (layerIndex == 1)
         animator.SetBool("Fire Attack", false);
     else if (layerIndex == 2)
         animator.SetBool("Ice Attack", false);
 }
コード例 #20
0
    void MovementAnimations()
    {
        var   locVel        = transform.InverseTransformDirection(playerRBody.velocity);
        bool  ground        = ginoController.moveSettings.isGrounded;
        bool  combat        = ginoController.combatSettings.inCombat;
        bool  wallCollision = ginoController.moveSettings.wallCollision;
        bool  climbingWall  = ginoController.moveSettings.climbingWall;
        float upSpeed       = playerRBody.velocity.y;
        float groundDist    = ginoController.height;
        float turnSpeed     = Input.GetAxis("Horizontal");
        float forwardSpeed;
        float climbUp      = locVel.y;
        float climbRight   = locVel.x;
        bool  breakingWall = ginoController.breakingWall;
        bool  block        = ginoController.blockInput;
        bool  charge       = false;
        bool  crouching    = ginoController.moveSettings.isCrouching;

        if (ginoController.runInput > 0 && ginoController.attackInput)
        {
            charge = true;
        }
        if (ginoController.attackInput && ginoController.runInput <= 0 && !animator.GetCurrentAnimatorStateInfo(0).IsName("Slap"))
        {
            combat = true;
        }


        if (!combat)
        {
            forwardSpeed = locVel.z;
        }
        else
        {
            forwardSpeed = Input.GetAxis("Vertical");
        }

        if (Input.GetAxis("Vertical") < -0.1f && !combat)
        {
            turnSpeed = 0;
        }
        //Normal Locomotion
        animator.SetFloat("MoveSpeed", forwardSpeed);
        animator.SetFloat("MoveDirection", turnSpeed);
        animator.SetFloat("groundDist", groundDist);
        animator.SetFloat("climbUp", climbUp);
        animator.SetFloat("climbRight", climbRight);
        animator.SetBool("isGrounded", ground);
        animator.SetBool("wallCollision", wallCollision);
        animator.SetBool("climbingWall", climbingWall);
        animator.SetBool("isCrouching", crouching);
        //Combat Locomotion
        animator.SetBool("inCombat", combat);
        animator.SetFloat("UpSpeed", upSpeed);
        animator.SetFloat("CombatForwardSpeed", forwardSpeed);
        animator.SetFloat("CombatSideSpeed", turnSpeed);
        animator.SetBool("block", block);
        animator.SetBool("charge", charge);
    }
コード例 #21
0
ファイル: IdleState.cs プロジェクト: Biciat/GameJamGame
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     animator.SetBool ("idle", true);
     animator.SetBool ("walk_l", false);
     animator.SetBool ("walk_r", false);
     animator.SetBool ("jump", false);
     animator.SetBool ("attack", false);
 }
コード例 #22
0
	// Use this for initialization
	void Start () {
		anim = GetComponent<Animator> ();
	

		anim.SetBool ("hover", false);
		anim.SetBool ("click", false);
		click = false;
	}
コード例 #23
0
 //OnStateEnter is called before OnStateEnter is called on any state inside this state machine
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called before OnStateUpdate is called on any state inside this state machine
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateExit is called before OnStateExit is called on any state inside this state machine
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (stateInfo.IsTag ("Transition")) {
         animator.SetBool ("Done", true);
     } else {
         animator.SetBool ("Done", false);
     }
 }
コード例 #24
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.GetBool("death"))
     {
         animator.SetBool("died", true);
         animator.SetBool("death", false);
     }
 }
コード例 #25
0
 // Use this for initialization
 void Start()
 {
     _move = false;
     _seePlayer = false;
     animate = this.gameObject.GetComponent<Animator>();
     animate.SetBool("seePlayer", _seePlayer);
     animate.SetBool("move", _move);
 }
コード例 #26
0
 public void MecanimEnterWater()
 {
     useMecanim = GetComponent<AttackTriggerC>().useMecanim;
     animator = GetComponent<PlayerMecanimAnimationC>().animator;
     animator.SetBool(jumpState , false);
     animator.SetBool("swimming" , true);
     animator.Play(swimIdle.name);
 }
コード例 #27
0
ファイル: Soldier.cs プロジェクト: SaviorsofBoredom/GameDev
    // Use this for initialization
    void Start()
    {
        currentHealth = maxHealth;

        animator = GetComponent<Animator> ();
        animator.SetBool ("Idle", true);
        animator.SetBool ("Sighted", false);
    }
コード例 #28
0
 // Use this for initialization
 void Start()
 {
     melt_.SetBool(Condition, false);
     fire_.SetBool("isFire", false);
     dropWaterSound = GetComponent <AudioSource>();
     soundManager   = GameObject.Find("EverySceneNeed").GetComponent <SoundManager>();
     uiManager      = GameObject.Find("UILayer").GetComponent <UIManager>();
 }
コード例 #29
0
 void Start(){
     anim = GetComponent<Animator>();
     anim.SetBool("IsGrounded", isGrounded);
     anim.SetBool("IsFacingLeft", isFacingLeft);
     anim.SetBool("IsFacingRight", isFacingRight);
     myAudioSource = GetComponent<AudioSource>();
     myRigid = GetComponent<Rigidbody2D>();
     controlScript = Camera.main.GetComponent<ControlScript>();
 }
コード例 #30
0
 //--
 void Start()
 {
     maxspeed=2f;//Set walk speed
     faceright=true;//Default right side
     anim = this.gameObject.GetComponent<Animator> ();
     anim.SetBool ("walk", false);//Walking animation is deactivated
     anim.SetBool ("dead", false);//Dying animation is deactivated
     anim.SetBool ("jump", false);//Jumping animation is deactivated
 }
コード例 #31
0
ファイル: AvatarCtrl.cs プロジェクト: Zhugejian/Figment
    void Start()
    {
        animator = GetComponent<Animator>();

        animator.SetBool("RunningFront", false);
        animator.SetBool("RunningBack", false);
        animator.SetBool ("FacingFront", false);
        animator.SetBool ("FacingBack", true);
    }
コード例 #32
0
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject.tag == "Item")
     {
         otherAnim = other.gameObject.GetComponent<Animator>();
         otherAnim.SetBool("Disappear", false);
         otherAnim.SetBool("Appear", true);
     }
 }
コード例 #33
0
    void Start()
    {
        rigidBody = GetComponent<Rigidbody>();
        animator = GetComponent<Animator>();
        animator.SetFloat("Speed", 0);
        animator.SetBool("Jump", false);
        animator.SetBool("Slide", false);
        timeSinceLastSlide = Time.time - movementSettings.slideDuration;

    }
コード例 #34
0
ファイル: AIMethods.cs プロジェクト: MaturuturuStudios/Drop
 /// <summary>
 /// Check drop size (go away or detect)
 /// </summary>
 public static void CheckDrop(Animator animator, int sizeLimitDrop)
 {
     int size = animator.GetInteger("SizeDrop");
     int sizeLimit = sizeLimitDrop;
     if (sizeLimit > 0 && size >= sizeLimit) {
         animator.SetBool("GoAway", true);
     } else if ((sizeLimit <= 0 || size < sizeLimit) && size > 0) {
         animator.SetBool("Detect", true);
     }
 }
コード例 #35
0
    // Use this for initialization
    void Start()
    {
        anim = this.GetComponent<Animator>();
        Ground = 1 << 12;

        anim.SetBool ("Right", true);
        anim.SetBool ("Left", true);
        anim.SetBool ("Up", true);
        anim.SetBool ("Down", true);
    }
コード例 #36
0
 void Update()
 {
     if (isWalking)
     {
         animator.SetBool("isWalking", true);
     }
     else
     {
         animator.SetBool("isWalking", false);
     }
 }
コード例 #37
0
ファイル: Defend.cs プロジェクト: yuyujunjun/VR-Garden
    //如果抢夺者在视野内,就追, 否则就认为防御成功
    public override TaskStatus OnUpdate()
    {
        //做一个安全的校验
        if (target == null && target.Value == null)
        {
            return(TaskStatus.Failure);
        }
        HP = enermyHealth.HP;
        //Debug.Log("Hp is " + HP);
        if (HP > fleeHP)
        {
            isHPFlee.Value = false;
        }
        if (HP <= fleeHP)
        {
            animator.SetBool("isHPFlee", false);
            isHPFlee.Value = true;
            //target = null;
            //target.Value = null;
            return(TaskStatus.Failure);
        }

        float sqrDistance = (target.Value.position - transform.position).sqrMagnitude;

        if (sqrDistance <= attackRange)
        {
            animator.SetBool("isInAttackRange", true);
        }
        else
        {
            animator.SetBool("isInAttackRange", false);
        }
        float angle = Vector3.Angle(transform.forward, target.Value.position - transform.position);

        if (sqrDistance < sqrViewDistance && angle < fieldOfViewAngle.Value * 0.5f)
        {
            if (navMeshAgent.destination != target.Value.position)
            {
                navMeshAgent.destination = target.Value.position;
            }

            return(TaskStatus.Running);
        }
        else
        {
            Debug.Log("quitChasing!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            animator.SetBool("isInView", false);
            return(TaskStatus.Failure);
        }
    }
コード例 #38
0
    public override void OnStart()
    {
        enermyHealth = this.GetComponent <EnermyHealth>();
        HP           = enermyHealth.HP;
        fleeHP       = enermyHealth.fleeHP;
        animator.SetBool("isInView", false);
        // initially move towards the closest waypoint
        float distance = Mathf.Infinity;
        float localDistance;

        for (int i = 0; i < waypoints.Value.Count; ++i)
        {
            if ((localDistance = Vector3.Magnitude(transform.position - waypoints.Value[i].position)) < distance)
            {
                distance      = localDistance;
                waypointIndex = i;
            }
        }

        // set the speed, angular speed, and destination then enable the agent
        navMeshAgent.speed        = speed.Value;
        navMeshAgent.angularSpeed = angularSpeed.Value;
        navMeshAgent.enabled      = true;
        navMeshAgent.destination  = Target();
    }
コード例 #39
0
        public void OnToggleValueChange(bool value)
        {
            if (!this.UseToggle || this.TargetToggle == null)
            {
                return;
            }

            this.active = this.TargetToggle.isOn;

            if (this.TransitionMode == UITransitionMode.Animation)
            {
                UnityEngine.Animator animator = this.GetAnimator();
                if (this.TargetGameObject == null ||
                    animator == null ||
                    !animator.isActiveAndEnabled ||
                    animator.runtimeAnimatorController == null ||
                    string.IsNullOrEmpty(this.ActiveBool))
                {
                    return;
                }

                animator.SetBool(this.ActiveBool, this.active);
            }

            this.DoStateTransition(this.active ? UITransitionVisualState.Active :
                                   this.selected ? UITransitionVisualState.Selected : this.highlighted ? UITransitionVisualState.Highlighted : UITransitionVisualState.Normal, false);
        }
コード例 #40
0
ファイル: animations.cs プロジェクト: MikhaelG/Team-exposure
    // Update is called once per frame
    void Update()
    {
        Animator.SetFloat("speed", Input.GetAxis("Horizontal")); // ser till att animationer spelas när spelaren går - Gustav


        if (Input.GetAxis("Horizontal") < 0)
        {
            direction = -1;
        }
        else if (Input.GetAxis("Horizontal") > 0)   // lagrar vilken riktning som spelaren senast gick i för att se till att den är vänd i rätt riktning - Gustav
        {
            direction = 1;
        }

        if (direction == -1)
        {
            sprite.flipX = true; // vänder spelaren i lämplig rikttning utifrån riktningen som den senast gick mot - Gustav
        }
        else
        {
            sprite.flipX = false;
        }
        if (Input.GetButtonDown("Jump")) // startar animationen för att hoppa - Gustav
        {
            Animator.SetFloat("jump", 1);
        }
        else if (rb.velocity.y < 0.01)
        {
            Animator.SetFloat("jump", rb.velocity.y);
        }
        Animator.SetBool("dashing", dash.DMG);
    }
コード例 #41
0
    // Update is called once per frame
    void Update()
    {
        animator.SetFloat("xSpeed", Mathf.Abs(body.velocity.x));

        animator.SetFloat("ySpeed", body.velocity.y);

        animator.SetBool("isSliding", movement.IsSliding);
    }
コード例 #42
0
    public override void OnStateEnter(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        controller = animator.gameObject.GetComponent <PlayerController>();
        //controller.OnTrigger2DStay += OnPlayerTrigger2DEnter;

        ani = animator;

        animator.SetBool("Idle", true);
    }
コード例 #43
0
            public static bool AnimeParamSet(
                UnityEngine.Animator animator,
                string name,
                object value,
                AnimatorControllerParameterType type)
            {
                switch (type - 1)
                {
                case 0:
                    animator.SetFloat(name, (float)value);
                    break;

                case 2:
                    animator.SetInteger(name, (int)value);
                    break;

                case 3:
                    animator.SetBool(name, (bool)value);
                    break;

                default:
                    if (type != 9)
                    {
                        return(false);
                    }
                    switch (value)
                    {
                    case null:
                        animator.ResetTrigger(name);
                        break;

                    case bool flag:
                        if (flag)
                        {
                            animator.SetTrigger(name);
                            break;
                        }
                        animator.ResetTrigger(name);
                        break;

                    case int num:
                        if (num != 0)
                        {
                            animator.SetTrigger(name);
                            break;
                        }
                        animator.ResetTrigger(name);
                        break;

                    default:
                        animator.SetTrigger(name);
                        break;
                    }
                    break;
                }
                return(true);
            }
コード例 #44
0
    // Use this for initialization
    void Start()
    {
        fire_.SetBool("isFire", false);
        GameObject girl = GameObject.Find("Girl");

        foreach (Transform trChild in transform)
        {
            if (trChild.GetComponent <Collider>() != null)
            {
                foreach (Transform trChild2 in transform)
                {
                    if (trChild2.GetComponent <Collider>() != null)
                    {
                        Physics.IgnoreCollision(trChild.gameObject.GetComponent <Collider>(), trChild2.gameObject.GetComponent <Collider>());
                    }
                }
                Physics.IgnoreCollision(trChild.gameObject.GetComponent <Collider>(), GetComponent <Collider>());
            }
        }
        uiManager    = GameObject.Find("UILayer").GetComponent <UIManager>();
        soundManager = GameObject.Find("EverySceneNeed").GetComponent <SoundManager>();
    }
コード例 #45
0
        public void SetAnimatorParameter()
        {
            if (!animator.enabled || !animator.gameObject.activeInHierarchy)
            {
                if (LogDebug)
                {
                    UnityEngine.Debug.Assert(animator.enabled && animator.gameObject.activeInHierarchy,
                                             "Setting the animator parameter while the animator is disabled may not register the change", this);
                }

                return;
            }


            if (isUnsafe)
            {
                return;
            }

            switch (ParameterType)
            {
            case AnimatorControllerParameterType.Float:
                animator.SetFloat(ParameterID, FloatValue.Value);
                break;

            case AnimatorControllerParameterType.Int:
                animator.SetInteger(ParameterID, IntValue.Value);
                break;

            case AnimatorControllerParameterType.Bool:
                animator.SetBool(ParameterID, BoolValue.Value);
                break;

            case AnimatorControllerParameterType.Trigger:
                animator.SetTrigger(ParameterID);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (PreventFewTriggersPerFrame)
            {
                StartCoroutine(MakeUnsafeTillEndOfFrame());
            }

            if (LogDebug)
            {
                UnityEngine.Debug.Log("Parameter Set", this);
            }
        }
コード例 #46
0
ファイル: EnermyHealth.cs プロジェクト: yuyujunjun/VR-Garden
 // Update is called once per frame
 void Update()
 {
     if (HP <= 0 && isDead == false)
     {
         isDead = true;
         animator.SetBool("isdead", true);
         this.GetComponent <BehaviorTree>().enabled = false;
         this.GetComponent <NavMeshAgent>().enabled = false;
         NotificationCenter.DefaultCenter().PostNotification(this, "IfCowDie");
         GameFacade.Instance.PlayNormalSound(AudioManager.Sound_howl);
         this.GetComponent <BoxCollider>().enabled = false;
         Destroy(this.gameObject, 10f);
     }
 }
コード例 #47
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonUp(0) || rope == null)
        {
            flag = false;
            animator_.SetBool("isFire", false);
        }
        if (!flag && Input.GetMouseButtonDown(0))
        {
            t_MouseDown = DateTime.Now;
            flag        = true;
        }

        if (flag && DateTime.Now - t_MouseDown > new TimeSpan(0, 0, 0, 1, 0))
        {
            var          ray         = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit[] hits        = Physics.RaycastAll(ray);
            bool         isHitSprite = false;
            bool         isHitRope   = false;
            foreach (RaycastHit hit in hits)
            {
                if (hit.collider.tag == "rope")
                {
                    isHitRope = true;
                }
                if (hit.collider.gameObject.tag == "BoySprite")
                {
                    isHitSprite = true;
                }
            }

            if (isHitSprite && isHitRope)
            {
                animator_.SetBool("isFire", true);
            }
        }
    }
コード例 #48
0
ファイル: Defend.cs プロジェクト: yuyujunjun/VR-Garden
 public override void OnStart()
 {
     Debug.Log("startChasing!!!");
     //target=GameObject.Find()
     animator = this.GetComponent <Animator>();
     animator.SetBool("isInView", true);
     enermyHealth = this.GetComponent <EnermyHealth>();
     HP           = enermyHealth.HP;
     fleeHP       = enermyHealth.fleeHP;
     Debug.Log("Hp is " + HP);
     sqrViewDistance = viewDistance.Value * viewDistance.Value;
     //启用导航组件
     navMeshAgent.enabled      = true;
     navMeshAgent.speed        = speed.Value;
     navMeshAgent.angularSpeed = angularSpeed.Value;
     navMeshAgent.destination  = target.Value.position;
 }
コード例 #49
0
    public override void OnStateUpdate(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        foreach (KeyValuePair <string, float> t in _enityData.DictActionTime)
        {
            if (stateInfo.normalizedTime > t.Value)
            {
                if (_listNode.Contains(t.Key) == false)
                {
                    _listNode.Add(t.Key);
                    _enity.SetProperty("normalizedTime", t.Key);
                }
            }
        }

        if (stateInfo.normalizedTime >= 0.95f + transitionTime)
        {
            if (!_isEnd)
            {
                //GameInput.Log("state to the end " + stateInfo.normalizedTime);
                _isEnd = true;
                animator.SetBool("isAttack", false);
                animator.Play("idle01");
                _enity.SetProperty("actinStateEnd", stateInfo);
            }
        }


        /* if (stateInfo.normalizedTime > 0.3f)//播放特效时间节点
         * {
         *   if (!_listNode.Contains("effectNode"))
         *   {
         *       _enity.SetProperty("normalizedTime", "effectNode");
         *       _listNode.Add("effectNode");
         *   }
         * }
         * if (stateInfo.normalizedTime > 0.6f)//播放受击动作时间节点
         * {
         *   if (!_listNode.Contains("beAtkNode"))
         *   {
         *       _enity.SetProperty("normalizedTime", "beAtkNode");
         *       _listNode.Add("beAtkNode");
         *   }
         * }*/
    }
コード例 #50
0
            public static bool AnimeParamSet(UnityEngine.Animator animator, string name, object value)
            {
                switch (value)
                {
                case float num:
                    animator.SetFloat(name, num);
                    break;

                case int num:
                    animator.SetInteger(name, num);
                    break;

                case bool flag:
                    animator.SetBool(name, flag);
                    break;

                default:
                    return(false);
                }
                return(true);
            }
コード例 #51
0
        public void SetAnimatorParameter(UnityEngine.Animator animator)
        {
            switch (ParameterType)
            {
            case AnimatorControllerParameterType.Float:
                animator.SetFloat(ParameterID, FloatValue.Value);
                break;

            case AnimatorControllerParameterType.Int:
                animator.SetInteger(ParameterID, IntValue.Value);
                break;

            case AnimatorControllerParameterType.Bool:
                animator.SetBool(ParameterID, BoolValue.Value);
                break;

            case AnimatorControllerParameterType.Trigger:
                animator.SetTrigger(ParameterID);
                break;
            }
        }
コード例 #52
0
    void Update()
    {
        if (!caughtPlayer)
        {
            SearchForPlayer();
        }
        else
        {
            agent.enabled = false;
        }

        isWalking = agent.velocity != Vector3.zero ? true : false;

        if (!isWalking)
        {
            audioSource.Pause();
        }
        else
        {
            audioSource.UnPause();
        }

        animator.SetBool("isWalking", isWalking);
    }
コード例 #53
0
    public void StartFire()
    {
        SpriteRenderer render = GetComponent <SpriteRenderer>();
        Sprite         sprite = render.sprite;

        print("sprite.name " + sprite.name);
        if (sprite.name == trayWithWater.name)
        {
            steam.SetBool("IsSteam", true);
            Rigidbody rb = transform.gameObject.GetComponent <Rigidbody>();
            rb.mass = 1;
            GetComponent <SpriteRenderer>().sprite = trayWithoutWater;
            if (!hasPrompt && gameObject.name == "right board")
            {
                GameObject.Find("UILayer").GetComponentInChildren <BtnPromptController>(true).SwitchPromptFrom(2);
                hasPrompt = true;
            }
            else if (!hasPrompt && gameObject.name == "left board")
            {
                GameObject.Find("UILayer").GetComponentInChildren <BtnPromptController>(true).SwitchPromptFrom(3);
                hasPrompt = true;
            }
        }
    }
コード例 #54
0
    public override void OnStateExit(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
    {
        //controller.OnTrigger2DStay -= OnPlayerTrigger2DEnter;

        animator.SetBool("Idle", false);
    }
コード例 #55
0
 public override void OnStateExit(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
 {
     animator.SetBool("Chase", false);
 }
コード例 #56
0
 // Use this for initialization
 void Start()
 {
     fire_.SetBool("isFire", false);
     uiManager = GameObject.Find("UILayer").GetComponent <UIManager>();
 }
コード例 #57
0
 // Use this for initialization
 void Start()
 {
     waterRise.SetBool("IsRaise", false);
 }
コード例 #58
0
 public void setOnGround(bool onGround)
 {
     animator.SetBool(Grounded, onGround);
 }
コード例 #59
0
ファイル: TvScript.cs プロジェクト: Snailpower/GGJ19
 public void enableWhiteNoise()
 {
     animator.SetBool("Activated", true);
     audiosources.transform.GetChild(4).GetComponents <StudioEventEmitter>()[0].SetParameter("TVParam", 1);
 }
コード例 #60
0
 // Update is called once per frame
 void Update()
 {
     animator.SetBool("won", win);
 }