Inheritance: MonoBehaviour
    // Use this for initialization
    void Start()
    {
        theAnimator = GetComponent<Animator> ();

        theCharacterShoot = GetComponentInParent<CharacterShoot> ();

        theCharacterJump = GetComponentInParent<CharacterJump> ();
    }
    // Use this for initialization
    void Start()
    {
        theAnimator = GetComponent <Animator> ();

        theCharacterShoot = GetComponentInParent <CharacterShoot> ();

        theCharacterJump = GetComponentInParent <CharacterJump> ();
    }
Exemple #3
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        theCamera = FindObjectOfType<MyCamera> ();
        thePlayer = GameObject.FindGameObjectWithTag("Player");
        theCharacterMotor = GetComponent<CharacterMotor> ();
        theCharacterShoot = GetComponent<CharacterShoot> ();

        enemyShotStartPos = transform.FindChild ("ShotStartPos").gameObject.GetComponent<Transform> ();
    }
Exemple #4
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        theCamera         = FindObjectOfType <MyCamera> ();
        thePlayer         = GameObject.FindGameObjectWithTag("Player");
        theCharacterMotor = GetComponent <CharacterMotor> ();
        theCharacterShoot = GetComponent <CharacterShoot> ();

        enemyShotStartPos = transform.FindChild("ShotStartPos").gameObject.GetComponent <Transform> ();
    }
Exemple #5
0
 /// 初始化人物的事件
 void Awake()
 {
     BehaviorState = new CharacterBehaviorState();
     _Camera       = gameObject.GetComponent <CameraController>();
     _controller   = GetComponent <CharacterBehaviorController>();
     _jetpack      = GetComponent <CharacterJetpack>();
     _shoot        = GetComponent <CharacterShoot> ();
     _thorns       = GetComponent <Thorns>();
     _RRRRR        = GetComponent <RRRRR>();
     _Cure         = GetComponent <HealthCure>();
     _Tank         = GetComponent <Tank>();
     _Buff         = GetComponent <Buff>();
     _SpeedUp      = GetComponent <SpeedUp>();
     _BigSkill     = GetComponent <BigSkill>();
     Health        = BehaviorParameters.MaxHealth;
     TankHealth    = BehaviorParameters.TankMaxHealth;
     if (GetComponent <Renderer>() != null)
     {
         _initialColor = GetComponent <Renderer>().material.color;
     }
 }
Exemple #6
0
        protected override void Update()
        {
            base.Update();

            HitDetect();

            if (CharacterSign.Alpha > 0)
            {
                CharacterSign.ResizeTo((float)Math.Abs(Math.Sin(Clock.CurrentTime * SineSpeed)) * SineHeight + NormalSize);
                CharacterSign.RotateTo((float)((Clock.CurrentTime / 1000) * DegreesPerSecond));
            }

            if (Shooting)
            {
                //Shooting every half beat
                timeSinceLastShoot += Clock.ElapsedFrameTime;
                if (timeSinceLastShoot / 1000.0 > 1 / BPM / 30.0)
                {
                    //sampleShoot.Play();
                    CharacterShoot?.Invoke();
                    timeSinceLastShoot -= 1 / (BPM / 30.0) * 1000.0;
                }
            }
        }
 public virtual void OnShoot(CharacterShoot shootingCharacter, GameObject shotCharacter, Vector3 velocity)
 {
     // Do nothing
 }
 /// <summary>
 /// Unity's method called right after this object is
 /// created, regardless if it's enabled or not.
 /// </summary>
 void Awake()
 {
     _controller = GetComponent<CharacterController>();
     _characterShoot = GetComponent<CharacterShoot>();
     _transform = transform;
 }
 public void OnExitShootMode(CharacterShoot character)
 {
     // Do nothing (mapped on update)
 }
 public virtual void OnExitShootMode(CharacterShoot character)
 {
     // Do nothing
 }
 public void OnShoot(CharacterShoot shootingCharacter, GameObject shotCharacter, Vector3 velocity)
 {
     // Plays the shooting effect
     Transform characterTransform = shotCharacter.transform;
     int size = shootingCharacter.GetComponent<CharacterSize>().GetSize() + shotCharacter.GetComponent<CharacterSize>().GetSize();
     float radius = _controller.radius * size;
     shoot.PlayEffect(characterTransform.position + radius * velocity.normalized, Quaternion.LookRotation(Vector3.forward, velocity), size);
 }
 void Awake()
 {
     // Retrieves the desired components
     _transform = transform;
     _ccc = GetComponent<CharacterControllerCustom>();
     _characterSize = GetComponent<CharacterSize>();
     _characterFusion = GetComponent<CharacterFusion>();
     _characterShoot = GetComponent<CharacterShoot>();
     _controller = GetComponent<CharacterController>();
     _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>();
 }
 /// <summary>
 /// Unity's method called right after the object is created.
 /// </summary>
 void Awake()
 {
     // Retrieves the desired components
     _ccc = GetComponentInParent<CharacterControllerCustom>();
     _characterSize = GetComponentInParent<CharacterSize>();
     _characterFusion = GetComponentInParent<CharacterFusion>();
     _characterShoot = GetComponentInParent<CharacterShoot>();
     _animator = GetComponent<Animator>();
     _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>();
     _drop = transform.parent.gameObject;
 }
 public void OnShoot(CharacterShoot shootingCharacter, GameObject shotCharacter, Vector3 velocity)
 {
     // Plays the shoot sound
     shoot.PlayAudio(shoot.shootSound);
 }
 // Use this for initialization
 void Start()
 {
     theCharacterShoot = GetComponent<CharacterShoot> ();
     theCharacterJump = GetComponent<CharacterJump> ();
     theCharacterMotor = GetComponent<CharacterMotor> ();
 }
    /// <summary>
    /// Unity's method called right after the object is created.
    /// </summary>
    void Awake()
    {
        // Retrieves the desired components
        _ccc = GetComponentInParent<CharacterControllerCustom>();
        _characterSize = GetComponentInParent<CharacterSize>();
        _characterShoot = GetComponentInParent<CharacterShoot>();
        _characterShootTrajectory = GetComponentInParent<CharacterShootTrajectory>();
        _eyesAttacher = GetComponent<EyesAttacher>();
        _transform = transform;
        _parent = _transform.parent;

        // Saves the model offset
        _originalModelOffset = _transform.localPosition;

        // Gets the joint information
        _joints = GetComponentsInChildren<Joint>();
        _jointsConnectedBodies = _joints.Select(e => e.connectedBody).ToArray();
        _originalJointsPosition = _joints.Select(e => e.transform.localPosition).ToArray();
    }
 // Use this for initialization
 void Start()
 {
     theCharacterShoot = GetComponent <CharacterShoot> ();
     theCharacterJump  = GetComponent <CharacterJump> ();
     theCharacterMotor = GetComponent <CharacterMotor> ();
 }
 public void OnExitShootMode(CharacterShoot character)
 {
     // Plays the exit shoot mode sound
     shoot.PlayAudio(shoot.exitShootModeSound);
 }
 public void OnEnterShootMode(CharacterShoot character)
 {
     // Do nothing
 }
    /// <summary>
    /// Unity's method called right after the object is created.
    /// </summary>
    void Awake()
    {
        // Retrieves the desired components
        _originalAudioSource = GetComponent<AudioSource>();
        _ccc = GetComponent<CharacterControllerCustom>();
        _characterSize = GetComponent<CharacterSize>();
        _characterFusion = GetComponent<CharacterFusion>();
        _characterShoot = GetComponent<CharacterShoot>();

        // The walk's audio source is the original one
        walk.audioSource = _originalAudioSource;

        // Creates a copy of the audio source for the other sounds
        jump.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        land.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        fuse.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        shoot.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        hit.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
        irrigate.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject);
    }
 public void OnShoot(CharacterShoot shootingCharacter, GameObject shotCharacter, Vector3 velocity)
 {
     // Sets the shoot trigger on the animator
     _animator.SetTrigger(CharacterAnimatorParameters.Shoot);
 }