Inheritance: MonoBehaviour
Exemple #1
0
        // OVERRIDE METHODS: ----------------------------------------------------------------------

        public override void EnableMotor()
        {
            Transform target = this.GetTarget();

            if (target != null)
            {
                this.targetRotationX = target.transform.rotation.eulerAngles.y;
                this.targetRotationY = target.transform.rotation.eulerAngles.x;
            }

            CharacterAnimator animator = HookPlayer.Instance.Get <CharacterAnimator>();

            switch (this.modelManipulator)
            {
            case ModelManipulator.Hide3DModel:
                animator.SetVisibility(false);
                break;

            case ModelManipulator.StiffSpineAnimation:
                animator.SetStiffBody(true);
                break;
            }

            this.cursorLock = Cursor.lockState;
        }
Exemple #2
0
    /// <summary>
    /// Updates the movement type of our character. If we return true, it means that our movement type has
    /// changed
    /// </summary>
    /// <returns></returns>
    private void SetMovementType(EMovementType NewMovementType)
    {
        if (NewMovementType == CurrentMovementType)
        {
            return;
        }
        int PreviousMovementType = (int)CurrentMovementType;

        EndMovementType(CurrentMovementType);
        CurrentMovementType = NewMovementType;

        switch (CurrentMovementType)
        {
        case EMovementType.STANDING:
            RemainingDoubleJumps = DoubleJumpCount;
            break;

        case EMovementType.CROUCH:
            AssociatedCollider.ColliderSize.y = CrouchingHeight;
            break;

        case EMovementType.IN_AIR:

            break;
        }
        CharacterAnimator.SetInteger(ANIM_MOVEMENT_STATE, (int)CurrentMovementType);
        CharacterAnimator.SetTrigger(ANIM_MOVEMENT_STATE_UPDATED);
    }
 private void Start()
 {
     npcController = GetComponent <NPCController>();
     npcController.TargetChanged += ChangeTarget;
     agent    = GetComponent <NavMeshAgent>();
     animator = GetComponent <CharacterAnimator>();
 }
        public void Interaction()
        {
            //Debug.Log("inside interaction");

            //This will make a Raycast at a Target in front of the Player with a distance of 1f (so basically the interacting object has to be close)
            if (CharacterAnimator.GetFloat("input_x") != 0)
            {
                direction = Physics2D.Raycast(transform.position, new Vector2(CharacterAnimator.GetFloat("input_x"), 0), 1f);
            }
            else
            {
                direction = Physics2D.Raycast(transform.position, new Vector2(0, CharacterAnimator.GetFloat("input_y")), 1f);
            }

            //We can use the collider to find the game object we are interacting with.
            // There need to be a few checks so the system doesnt interact with unintended objects
            // These include: 1.) it cant be the Player itself     2.) Uninteractable tagged objects which should include Enemies
            if (direction.collider != null && direction.collider.name != "Player" && (direction.collider.tag == "interactable" || direction.collider.tag == "NPC"))
            {
                //we can call the targets interact stuff here

                //Debug.Log("found a Target");
                currentlyInteracting = true;

                //we shouldnt be allowed to Attack or move during interactions since that would look just weird
                CharacterAnimator.SetBool("isWalking", false);
                canMove   = false;
                canAttack = false;

                //send message to raycast Target to interact with us
                direction.collider.gameObject.SendMessage("PlayerInteraction", null, SendMessageOptions.DontRequireReceiver);
            }
        }
Exemple #5
0
 public void Die()
 {
     if (CharacterAnimator != null)
     {
         CharacterAnimator.SetTrigger("Die");
     }
 }
Exemple #6
0
 public void Cry()
 {
     if (CharacterAnimator != null)
     {
         CharacterAnimator.SetTrigger("Failure");
     }
 }
Exemple #7
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.tag.Equals ("enemyProjectile")) {
         other.gameObject.SendMessage ("hit");
         myAnimator = new CharacterAnimator (new int[]{0,1,0,1,0,1}, this, movementRate);
     }
 }
Exemple #8
0
 public void BeMagicallyAttacked()
 {
     if (CharacterAnimator != null)
     {
         CharacterAnimator.SetTrigger("BeAttacked");                           //TODO:改成魔法攻击
     }
 }
Exemple #9
0
        /// <summary>
        /// Everything you want to happen when the GameObject takes damage but doesnt die.
        /// </summary>
        /// <param name="otherTransform">Other transform.</param>
        /// <param name="joltAmount">Jolt amount.</param>
        private void Hit(Transform otherTransform, float joltAmount)
        {
            // Play the sound from getting hit.
            Grid.soundManager.PlaySound(GetHitSound, transform.position, 1f, 1f);

            // IF this animator has a state called Hit.
            if (CharacterAnimator.HasState(0, Animator.StringToHash("Hit")))
            {
                // Start a coroutine to handle the timing of the GameObject being hit.
                StartCoroutine(HitAnimation());
            }

            // IF the character that we collided with can be knockedback.
            if (CanBeJolted)
            {
                // Get the relative position.
                Vector2 relativePos = gameObject.transform.position - otherTransform.position;
                // Get the rigidbody2D
                Rigidbody2D charRigid = characterEntity.GetComponent <Rigidbody2D> ();
                // Stop the colliding objects velocity.
                charRigid.velocity = Vector3.zero;
                // Apply knockback.
                charRigid.AddForce(relativePos.normalized * joltAmount, ForceMode2D.Impulse);
                // Make the character not be able to be controled while being knockedback.
                StartCoroutine(NoCharacterControl());
            }
        }
Exemple #10
0
 public CharacterMachineState(CharacterStateMachine stateMachine)
 {
     Machine  = stateMachine;
     control  = Machine.Character.GetComponentInFamily <CharacterControlInput>();
     animator = Machine.Character.GetComponentInFamily <CharacterAnimator>();
     motion   = Machine.Character.GetComponentInFamily <Rigidbody2DMotion>();
 }
Exemple #11
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (TakeDamege)
        {
            playerRigidbody.velocity = Vector2.zero;
            return;
        }
        float horizontal = Input.GetAxis("Horizontal");

        IsGrounded = Grounded();

        if (playerRigidbody.position.y <= -14f)
        {
            Death();
        }


        HandleLayers();
        PlayerChangeDirection(horizontal);
        HandleInput();
        HandleMovement(horizontal);



        Reset();
        isSliding = CharacterAnimator.GetCurrentAnimatorStateInfo(0).IsName("Slide");
    }
    public CharacterBlock(float timeParry,
                          float blockRange,
                          float _timeToBlock,
                          int maxCharges,
                          float timeRecuperate,
                          GameObject _ui,
                          CharacterAnimator _anim,
                          Func <EventStateMachine <CharacterHead.PlayerInputs> > _sm,
                          ParticleSystem _parryParticles) : base(timeParry, blockRange)
    {
        anim                = _anim;
        OnBlock            += OnBlockDown;
        UpBlock            += OnBlockUp;
        sm                  = _sm;
        parryParticles      = _parryParticles;
        OnParry            += FinishParry;
        BeginParry         += Parry;
        BeginParry         += ParryFeedback;
        timeBlock           = _timeToBlock;
        maxBlockCharges     = maxCharges;
        CurrentBlockCharges = maxCharges;
        timeToRecuperate    = timeRecuperate;
        var newUi = MonoBehaviour.Instantiate(_ui, Main.instance.gameUiController.MyCanvas.transform);

        ui = newUi.GetComponentInChildren <UI_GraphicContainer>();
        ui.OnValueChange(CurrentBlockCharges, maxBlockCharges);
    }
Exemple #13
0
        void Start()
        {
            // Activar a cámara inicial
            if (thirdPersonCamFlag)
            {
                currentCamera             = thirdPersonCamera;
                thirdPersonCamFlag        = true;
                thirdPersonCamera.enabled = true;
                firstPersonCamera.enabled = false;
            }
            else
            {
                currentCamera             = firstPersonCamera;
                thirdPersonCamFlag        = false;
                thirdPersonCamera.enabled = false;
                firstPersonCamera.enabled = true;
            }

            weaponManager     = gameObject.GetComponentInChildren <WeaponManager>();
            characterAnimator = GetComponent <CharacterAnimator>(); //componente para animacions
            //thirdPersonCamera = GetComponent<ThirdPersonCamera>();
            //firstPersonCamera = GetComponent<FirstPersonCamera>();

            //Añadir observer ao subject
            GameHandler.instance.RegisterObserverPause(this);
            //Observer pero usando eventos
            GameHandler.instance.onPlayerDied += Die;
        }
Exemple #14
0
    public void attackAnim()
    {
        GameObject        playerAnimator = GameObject.Find("Player");
        CharacterAnimator charAnim       = playerAnimator.GetComponent <CharacterAnimator>();

        charAnim.animator.SetTrigger("attack");
    }
    public AbstractAction(GameObject actor)
    {
        this.actor = actor;

        state = actor.GetComponent(typeof(CharacterState)) as CharacterState;
        animator = actor.GetComponent(typeof(CharacterAnimator)) as CharacterAnimator;
        mover = actor.GetComponent(typeof(CharacterMover)) as CharacterMover;
        actionRunner = actor.GetComponent(typeof(ActionRunner)) as ActionRunner;

        animationName = null;
        wrapMode = WrapMode.Once;
        emotionBodyParts = Emotion.BodyParts.NONE;

        canStartDialogueWithPC = true;
        canStartDialogueWithAgents = true;
        canEndAnyTime = true;
        //canCancelDuringMovement = true;

        quickReaction = null;
        moveToAction = null;

        started = false;
        endedASAP = false;
        endNextRound = false;

        finished = false;
    }
Exemple #16
0
 private void Start()
 {
     _cam    = GetComponent <ThirdPersonCameraTarget>();
     _glider = GetComponent <ParagliderTarget>();
     _anim   = GetComponentInChildren <CharacterAnimator>();
     _move   = GetComponent <Movement>();
 }
Exemple #17
0
        private IEnumerator HitAnimation()
        {
            CharacterAnimator.SetBool("IsHit", true);
            yield return(new WaitForSeconds(HitAnimationTime));

            CharacterAnimator.SetBool("IsHit", false);
        }
Exemple #18
0
 public void BeMagicallyBuff()
 {
     if (CharacterAnimator != null)
     {
         CharacterAnimator.SetTrigger("BeMagicallyBuff");                           //魔法增益
     }
 }
Exemple #19
0
		//コンストラクタ
		public TransitionInfo(float time,CharacterAnimator.Animation animation,CharacterAnimator.State state)
		{
			this._TransitionTime = time;
			this._Animation = (int)animation;
			this._State = (int)state;

		}
Exemple #20
0
 public void Cheer()
 {
     if (CharacterAnimator != null)
     {
         CharacterAnimator.SetTrigger("Victory");
     }
 }
Exemple #21
0
    // Update is called once per frame
    void Update()
    {
        if (!isInitialized)
        {
            waypoints = new List <Waypoint>();
            Waypoint[] waypointsTemporary = FindObjectsOfType <Waypoint>();
            foreach (Waypoint w in waypointsTemporary)
            {
                waypoints.Add(w);
            }

            rb       = GetComponent <Rigidbody2D>();
            animator = GetComponent <CharacterAnimator>();
            animator.PlayIdleAnimation();

            StartCoroutine(DelayedWalk());

            isInitialized = true;
        }

        if (isMoving && rb.position.x >= currentWaypoint.transform.position.x)
        {
            rb.velocity           = new Vector3(0f, rb.velocity.y);
            rb.transform.position = new Vector2(currentWaypoint.transform.position.x,
                                                rb.transform.position.y);
            isMoving = false;
            animator.PlayIdleAnimation();
            currentWaypoint.ReachWaypoint();
        }
    }
Exemple #22
0
 void Start()
 {
     target            = PlayerManager.instance.player.transform;
     agent             = GetComponent <NavMeshAgent>();
     combat            = GetComponent <CharacterCombat>();
     characterAnimator = GetComponent <CharacterAnimator>();
 }
Exemple #23
0
    // we will need this c# magic for our animation state when its in
    //public bool isMovingTest
    //{
    //    set
    //    {
    //        if (Input.GetAxis("Vertical") == 0 && Input.GetAxis("Horizontal") == 0) { isMoving = false; }
    //        else { isMoving = true; }
    //    }
    //    get { return isMoving; }
    //}


    // Start is called before the first frame update
    void Start()
    {
        charDirection     = this.GetComponent <CharDirection>();
        characterMover    = this.GetComponent <CharacterMover>();
        characterAnimator = this.GetComponent <CharacterAnimator>();
        worldInteracter   = this.GetComponent <WorldInteracter>();
    }
 // Start is called before the first frame update
 void Start()
 {
     // get scripts we need
     charDirection     = this.GetComponent <CharDirection>();
     characterMover    = this.GetComponent <CharacterMover>();
     characterAnimator = this.GetComponent <CharacterAnimator>();
 }
Exemple #25
0
        protected override IEnumerator MainAttack()
        {
            if (targetsCount == 0)
            {
                yield break;
            }
            var targetPos       = TargetPositions.Dequeue();
            var canAttackFirst  = CanAttack(targetPos);
            var canAttackSecond = CanAttack(secondTargetPos);

            if (canAttackFirst || canAttackSecond)
            {
                yield return(StartCoroutine(CharacterAnimator.RandomAttackCor()));
            }
            else
            {
                yield break;
            }

            yield return(StartCoroutine(Move.RotateToPosition(targetPos)));

            var firstEnemy = Field.GetGameObjectByIndex <Health>(targetPos);

            if (firstEnemy)
            {
                firstEnemy.GetDamage(damage);
            }

            var secondEnemy = Field.GetGameObjectByIndex <Health>(secondTargetPos);

            if (secondEnemy)
            {
                secondEnemy.GetDamage(damage - 1);
            }
        }
Exemple #26
0
    void ProcessInput()
    {
        if (playerIsLocked)
        {
            if (Input.GetMouseButton(0) && canPerformAction)
            {
                switch (currentActivity)
                {
                case LoggingActivity.FELLING:
                    ChopDiagonal();
                    break;

                case LoggingActivity.BUCKING:
                    Saw();
                    break;

                case LoggingActivity.SPLITTING:
                    ChopVertical();
                    break;
                }
            }
            else
            {
                CharacterAnimator.EndActionLoop();
            }
        }
    }
Exemple #27
0
    public override void DoUpdate(float dt)
    {
        //成功
        if (CharacterAnimator.AnimatorState.Success)
        {
            CharacterAnimator.SetSuccess();
            return;
        }
        //失败
        if (CharacterAnimator.AnimatorState.Failed)
        {
            CharacterAnimator.SetFailed();
            return;
        }
        CharacterAnimator.DoUpdate(dt);

        if (IsGrounded() && !NeedJump)
        {
            if (Target != null)
            {
                Agent.destination = Target.position;
            }

            var isMove = Agent.velocity.x != 0 && Agent.velocity.z != 0;
            CharacterAnimator.SetRun(isMove);

            var isIdle = Agent.velocity == Vector3.zero;
            CharacterAnimator.SetIdle(isIdle);
        }
    }
Exemple #28
0
        protected override IEnumerator MainAttack()
        {
            if (TargetPositions.Count == 0)
            {
                yield break;
            }
            while (TargetPositions.Count > 0)
            {
                var targetPos       = TargetPositions.Dequeue();
                var targetSquadType = Field.GetSquadTypeByIndex(targetPos);
                if (targetSquadType == SquadType.NotMatter)
                {
                    continue;
                }
                if (targetSquadType == SquadType)
                {
                    continue;
                }
                yield return(StartCoroutine(Move.RotateToPosition(targetPos)));

                yield return(StartCoroutine(CharacterAnimator.RandomAttackCor()));

                var enemyHealth = Field.GetGameObjectByIndex <Health>(targetPos);
                enemyHealth.GetDamage(damage);
                yield return(new WaitForSeconds(0.5f));
            }
        }
Exemple #29
0
    private void RpcMove(float horizontalMovement, float verticalMovement, Quaternion targetRotation)
    {
        //apply input to movement direction
        movement = new Vector3(horizontalMovement, 0.0f, verticalMovement);

        //apply camera direction to movement
        movement   = Camera.main.transform.TransformDirection(movement);
        movement.y = 0.0f;
        movement.Normalize();

        //apply speed to movement
        movement *= Speed;

        //change moving state to true when moving
        Moving = horizontalMovement != 0 || verticalMovement != 0;

        if (Moving == true)
        {
            newRotation = Quaternion.Lerp(GetComponent <Rigidbody>().rotation, targetRotation, rotationSpeed * Time.deltaTime);
            //rotate character
            GetComponent <Rigidbody>().MoveRotation(newRotation);
            Vector3 characterMovement = transform.position + movement;
            //move character
            GetComponent <Rigidbody>().MovePosition(characterMovement);
            //fade into running animation
            CharacterAnimator.CrossFade("Run", 0.0f);
            //change character state to moving
            State = CharacterState.moving;
        }
    }
Exemple #30
0
    protected override IEnumerator Catching()
    {
        if (currentBeardState == BeardState.Short || currentAttack != PlayerAttacks.None)
        {
            yield break;
        }

        CancelInvoke("GrowBeard");
        currentAttack = PlayerAttacks.Catch;
        isCatching    = true;
        CharacterAnimator.SetInteger("State", 4);

        if (PhotonNetwork.isMasterClient)
        {
            float _timer = 0;

            while (_timer < catchTime)
            {
                TDS_RPCManager.Instance.RPCManagerPhotonView.RPC("ApplyInfoDamages", PhotonTargets.All, TDS_RPCManager.Instance.SetInfoDamages(CheckHit(1, 1), PhotonViewElementID));

                yield return(new WaitForSeconds(.05f));

                _timer += .05f;
            }
        }
        else
        {
            yield return(new WaitForSeconds(catchTime));
        }

        currentAttack = PlayerAttacks.None;
        isCatching    = false;
        InvokeRepeating("GrowBeard", 1, 1);
    }
Exemple #31
0
 public void BeAttacked()
 {
     if (CharacterAnimator != null)
     {
         CharacterAnimator.SetTrigger("BeAttacked");
     }
 }
Exemple #32
0
    private void handleInput()
    {
        if (Input.GetKey(KeyCode.RightArrow) && xspeed > 0)
        {
            movingDirection = 1;
        }

        if (Input.GetKey(KeyCode.LeftArrow) && xspeed < 0)
        {
            movingDirection = -1;
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            CharacterAnimator.SetTrigger("attack");
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            CharacterAnimator.SetTrigger("shoot");
        }

        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            CharacterAnimator.SetTrigger("dodge");
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            Debug.Log(OnGround);
            CharacterAnimator.SetTrigger("jump");
        }
    }
Exemple #33
0
    void ChangeTool()
    {
        if (doChangeTool)
        {
            // Debug.Log("Current Tool: " + PlayerTools.GetCurrentlyEquippedToolIndex());
            // Debug.Log("To Equip Tool: " + ToolManager.GetToolToEquipIndex());

            int startLoc = 0;
            if (PlayerTools.GetCurrentlyEquippedToolIndex() > 0)
            {
                startLoc = (PlayerTools.GetCurrentlyEquippedToolIndex() == 2) ? 2 : 1;
            }

            int endLoc = 0;
            if (ToolManager.GetToolToEquipIndex() > 0)
            {
                endLoc = (ToolManager.GetToolToEquipIndex() == 2) ? 2 : 1;
            }

            CharacterAnimator.SetEquipLocations((float)startLoc, (float)endLoc);
            CharacterAnimator.SetSwitchToolAsAction();

            PlayerHud.PlayerHudReference.ChangeToolIcon();

            // Debug.Log("Start Loc: " + startLoc);
            // Debug.Log("End Loc: " + endLoc);

            doChangeTool = false;
        }
    }
 public void Awake()
 {
     kk = false;
     if (gameObject.GetComponent<CharacterAnimator> () != null)
         anim = gameObject.GetComponent<CharacterAnimator> ();
     else
         anim = null;
     sp = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
 }
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     AssetBufferer.BufferImages(this.Content);
     this.character = new CharacterEntity(this.GraphicsDevice);
     this.characterAnimator = new CharacterAnimator(this.character);
     this.inputHandler = new PlayerInputHandler(this.character);
     this.fallingStuffAnimator = new FallingStuffAnimator();
     this.collisionHandler = new CollisionHandler(this.character, this.fallingStuffAnimator.fallingEntites);
     this.graphics.PreferredBackBufferWidth = Globals.GLOBAL_WIDTH;
     this.graphics.PreferredBackBufferHeight = Globals.GLOBAL_HEIGHT;
     this.graphics.ApplyChanges();
     base.Initialize();
 }
		public Scenariodate(string text_date,float time ,Route next_route = Route.Main,
		                    CharacterAnimator.Animation jony_animation = CharacterAnimator.Animation.UpScaling,
		                    CharacterAnimator.Animation abery_animation = CharacterAnimator.Animation.UpScaling,
		                    
		                    CharacterAnimator.State jony_state = CharacterAnimator.State.Normal,
							CharacterAnimator.State abery_state = CharacterAnimator.State.Normal,
							int camera_number = -1,
							CameraAnimator.Animation camera_animation = CameraAnimator.Animation.Null,
			ExtraAnimator.Animation extra_animation = ExtraAnimator.Animation.NULL,
			SEManager.SE se_petern = SEManager.SE.NoSound)
		{
			this._text_date = text_date;
			this._next_route = next_route;
			this._time = time;

			this._jony_animation  = jony_animation;
			this._jony_state      = jony_state;
			this._abery_animation = abery_animation;
			this._abery_state     = abery_state;
			this._camera_number   = camera_number;
			this._camera_animation = camera_animation;
			this._extra_animation = extra_animation;
			this._se_pertern = se_petern;
		}
 //public Transform neck;
 public void Start()
 {
     animator = GetComponent(typeof(CharacterAnimator)) as CharacterAnimator;
     controller = (CharacterController)gameObject.GetComponent(typeof(CharacterController));
     idleActionPlayed = false;
     enabled=false;
 }
	// Use this for initialization
	void Start () {

		Jony = (GameObject.FindGameObjectWithTag ("Jony")).GetComponent<CharacterAnimator>();
		Abery = GameObject.FindGameObjectWithTag ("Abery").GetComponent<CharacterAnimator>();
		_extra_animator = GameObject.FindObjectOfType<ExtraAnimator> ();
		_scenario_text = GameObject.FindObjectOfType<ScenarioText> ();
		_view_camera = GameObject.FindObjectOfType<ChangeCamera> ();
		_camera_animator = GameObject.FindObjectOfType<CameraAnimator> ();
		_cv_reference = GameObject.FindObjectOfType<CVManager> ();
		_se_reference= GameObject.FindObjectOfType<SEManager> ();
		_start_count = GameObject.FindObjectOfType<StartCount> ();
		Style = new GUIStyle();
		State = new GUIStyleState();
        

		//CSVデータから、ルートごとに分けてテキストデータ等を読み込む
		var MasterTable = new CSVMasterTable();
		MasterTable.Load();
		foreach (var Master in MasterTable.All)
		{
			//一度データを取り出す。
			Scenariodate data = new  Scenariodate (
				Master.Scenario, Master.WatchTime, (Route)Master.NextRoute,
				Master.JonyAnimation, Master.AberyAnimation,
				Master.JonyState, Master.AberyState,
				Master.CameraNumber,Master.CameraAnimation,
				Master.ExtraAnimation,Master.SEPetern);

			//ルートにあわせて保存
			switch ((Route)Master.CurrentRoute) {
				 
			case Route.Main:
				
				_Main.Add (data);

				break;
			case Route.A:
				
				_A.Add(data);
				
				break;
			case Route.B:
				
				_B.Add(data);
				
				break;
			case Route.C:
				
				_C.Add(data);
				
				break;
				
			}
			
		}
		
		//	_A.Add(new Scenariodate("ENDTEXT",0,Route.Main));
		//_B.Add(new Scenariodate("ENDTEXT",0,Route.Main));
		//_C.Add(new Scenariodate("ENDTEXT",0,Route.Main));

		_cv_reference.Init();
		_next_route = Route.NULL;
        _do_skip_text = false;
		//UpdateScenerio (Route.Main);

		
	}
 public virtual void Awake()
 {
     animator = GetComponent<CharacterAnimator> ();
     sp = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<SpFunctions> ();
 }
Exemple #40
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            m_character = Content.Load<CharacterModel>(@".\graphics\models\Example").CreateAnimator("monster");
            m_character.ChangeAnimation("Idle");

            // TODO: use this.Content to load your game content here
        }
 void Awake()
 {
     characterAnimator = GetComponent<CharacterAnimator>();
 }
    void Awake()
    {
        actNumb = 0;

        rigid = gameObject.GetComponent<Rigidbody2D> ();
        stats = gameObject.GetComponent<Stats> ();
        animator = GetComponent<CharacterAnimator> ();
        actions = gameObject.GetComponent<Actions> ();
        infoGets = gameObject.GetComponent<InfoGets> ();
        clav = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<clavisher> ();
        Sp=GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
        equip = gameObject.GetComponent<Equipment> ();
    }
Exemple #43
0
	public void SetDefaults() 
	{
		// references to other classes
		MyGameManager = GetManager.GetGameManager ();	
		MyData = GetManager.GetDataManager ();
		MyAnimator = gameObject.GetComponent<CharacterAnimator> ();
		// Sound stuff
		SoundSource = GetComponent<AudioSource>();
		if (transform.childCount >= 2)
			SoundSource2 = transform.GetChild(1).GetComponent<AudioSource>();
		// sound cooldown
		LastSound = Time.time;
		MyStats.SetDefaults ();	// need a load option instead of defaults
		MyInventory.Clear ();
	}
 //public Transform neck;
 public void Start()
 {
     animator = (CharacterAnimator)GetComponent("CharacterAnimator");
 }