예제 #1
0
파일: Bullet.cs 프로젝트: srawls1/GMTK-Jam
 void Start()
 {
     if (character == null)
     {
         character = FindObjectOfType <CharacterShooting>();
     }
 }
예제 #2
0
    private void Awake()
    {
        m_spriteRenderer = GetComponent <SpriteRenderer>();

        m_shootingBehavior = GetComponent <CharacterShooting>();
        m_scoring          = GetComponent <CharacterScoring>();
        m_movement         = GetComponent <CharacterMovementB>();
    }
예제 #3
0
        public void Setup()
        {
            // Get references to the components.
            Movement           = Instance.GetComponent <CharacterMovement>();
            Shooting           = Instance.GetComponent <CharacterShooting>();
            Health             = Instance.GetComponent <CharacterHealth>();
            CharacterBehaviour = Instance.GetComponent <CharacterBehaviour>();
            CharacterShield    = Instance.GetComponent <CharacterShield>();
            CharacterSetup     = Instance.GetComponent <CharacterSetup>();

            Movement.OnDestroyOject += () =>
            {
                Instance           = null;
                Movement           = null;
                Shooting           = null;
                Health             = null;
                CharacterBehaviour = null;
                CharacterShield    = null;
                CharacterSetup     = null;
                GameManager.Characters.Remove(this);
            };

            // Get references to the child objects.
            CharacterRenderers = Health.CharacterRenderers;

            //Set a reference to that amanger in the health script, to disable control when dying
            Health.Manager = this;

            // Set the player numbers to be consistent across the scripts.
            Movement.PlayerNumber = PlayerNumber;
            Movement.LocalID      = LocalPlayerID;

            Shooting.PlayerNumber = PlayerNumber;
            Shooting.localID      = LocalPlayerID;

            //setup is use for diverse Network Related sync
            CharacterSetup.Color        = PlayerColor;
            CharacterSetup.PlayerName   = PlayerName;
            CharacterSetup.PlayerNumber = PlayerNumber;
            CharacterSetup.LocalId      = LocalPlayerID;

            CharacterShield.PlayerNumber = PlayerNumber;
            CharacterShield._character   = CharacterBehaviour;
        }
    void Awake()
    {
        player = GetComponentInParent <CharacterShooting>();

        // Getting PlayerControls Script
        _controls = new PlayerControls();

        _controls.devices = InputSystem.devices;

        // Left Stick For Movement
        _controls.Gameplay.Move.performed += ctx => MoveFunc(ctx, "performed");
        _controls.Gameplay.Move.canceled  += ctx => MoveFunc(ctx, "cancelled");

        // Sprinting
        _controls.Gameplay.LStickDown.performed += ctx => RunningFunc(ctx);
        _controls.Gameplay.LStickDown.canceled  += ctx => RunningFunc(ctx);

        // Crouching
        _controls.Gameplay.Crouch.performed += ctx => CrouchFunc(ctx);
        _controls.Gameplay.Crouch.canceled  += ctx => CrouchFunc(ctx);

        _controls.Gameplay.LStickDown.canceled += ctx => moveSpeed = 1;

        // Right Stick For Camera Rotation
        _controls.Gameplay.Rotate.performed += ctx => RotationFunc(ctx, "performed");
        _controls.Gameplay.Rotate.canceled  += ctx => RotationFunc(ctx, "cancelled");

        // Fire Button
        _controls.Gameplay.Fire.performed += ctx => TakeShotFunc(ctx, "performed");
        _controls.Gameplay.Fire.canceled  += ctx => TakeShotFunc(ctx, "cancelled");

        // Trigger for Draw Bow
        _controls.Gameplay.DrawBow.performed += ctx => DrawBowFunc(ctx, "performed");
        //_controls.Gameplay.DrawBow.performed += ctx => player.shooting = true;
        _controls.Gameplay.DrawBow.canceled += ctx => DrawBowFunc(ctx, "cancelled");

        // Jump Button
        //_controls.Gameplay.Jump.performed += ctx => JumpFunc(ctx);

        // Getting RigidBody for Movement
        rb = GetComponent <Rigidbody>();
    }
예제 #5
0
    public void Alive()
    {
        circleCollider = GetComponent <CircleCollider2D>();
        CharacterShooting shooting = GetComponent <CharacterShooting>();
        CharacterMovement movement = GetComponent <CharacterMovement>();

        if (movement)
        {
            movement.enabled = false;
        }
        if (circleCollider)
        {
            circleCollider.isTrigger = true;
        }
        if (shooting)
        {
            shooting.enabled = false;
        }
        isDeath = false;
    }
예제 #6
0
    private void LogicDeathBlock()
    {
        circleCollider = GetComponent <CircleCollider2D>();
        CharacterShooting shooting = GetComponent <CharacterShooting>();
        CharacterMovement movement = GetComponent <CharacterMovement>();

        if (movement)
        {
            movement.enabled = false;
        }
        //if (collider2D)
        //    collider2D.isTrigger = true;
        if (shooting)
        {
            shooting.enabled = false;
        }
        isDeath = true;
        audio   = GetComponent <AudioSource>();
        AudioManager.Pause("Walk", audio);
    }