Inheritance: MonoBehaviour
コード例 #1
0
        protected override void Initialize()
        {
            base.Initialize();
            ball         = FindObjectOfType <BallBehaviour>();
            detectGround = FindObjectOfType <DetectGround>();

            ballCollision.OnDetect   += AutomaticKickBall;
            playerCollision.OnDetect += AutomaticKickPlayer;
        }
コード例 #2
0
    private void Start()
    {
        GameObject[] go = GameObject.FindGameObjectsWithTag("DectectGround");

        for (int n = 0; n < go.Length; n++)
        {
            mDetectGrArr[n] = new DetectGround();
            mDetectGrArr[n] = go[n].GetComponent <DetectGround>();
        }
    }
コード例 #3
0
        protected override void Initialize()
        {
            base.Initialize();

            rb           = GetComponent <Rigidbody>();
            thisCollider = GetComponent <Collider>();
            detectGround = GetComponent <DetectGround>();

            lifeSlider          = GameManager.Instance.hudStats[character.playerIndex].lifeSlider;
            lifeSlider.maxValue = maxLife;
            lifeSlider.value    = maxLife;

            isKnockout       = false;
            extendKnockTimer = false;
        }
コード例 #4
0
        protected virtual void Awake()
        {
            anim = GetComponent <Character>().model.GetComponent <Animator>();

            rb           = GetComponent <Rigidbody>();
            detectGround = GetComponent <DetectGround>();

            characterSkill = GetComponent <CharacterSkill>();
            skillHeadButt  = GetComponent <CharacterSkillHeadButt>();
            skillKick      = GetComponent <CharacterSkillKick>();
            skillJump      = GetComponent <CharacterSkillJump>();


            canMove      = true;
            lastPosition = transform.position;
        }
コード例 #5
0
 private void Start()
 {
     feet = GetComponentInChildren <DetectGround>();
     GetComponent <Rigidbody2D>().gravityScale = 2f;
     mySpeed           = 0.4f;
     maxDistanceDelta  = 0.15f;
     jumpAccelerate    = 0.2f;
     jumpDistanceDelta = 0.15f;
     GetComponent <PolygonCollider2D>().offset = new Vector2(-0.1f, 0f);
     if (isMap)
     {
         float   x        = PlayerPrefs.GetFloat("memoryX");
         float   y        = PlayerPrefs.GetFloat("memoryY");
         Vector2 startPos = new Vector2(x, y);
         transform.localPosition = startPos;
     }
 }
コード例 #6
0
    private float projectileCooldown; //limit how often we can shoot

    // Use this for initialization
    void Start()
    {
        time_Tracker       = 0;
        timeSinceLastPress = 0;
        m_Feet             = gameObject.GetComponentInChildren <DetectGround>();
        UI_Slider          = GameObject.FindGameObjectWithTag("UI_Slider").GetComponent <Slider>();
        m_Animator         = gameObject.GetComponent <Animator>();
        m_rb2D             = gameObject.GetComponent <Rigidbody2D>();
        SpaceAlternator    = false;
        isStunned          = false;
        isGrounded         = true;
        staminaFloat       = 60f;
        m_renderer         = GetComponent <SpriteRenderer>();
        maxSpeed           = 10f;
        isSliding          = false;
        slideDur           = -1f;
        projectileCooldown = 0;
    }
コード例 #7
0
 private void Awake()
 {
     player      = FindObjectOfType <PlayerMovement>();
     target      = player.gameObject.transform;
     startRight  = facingRight;
     home        = transform.position;
     _controller = GetComponent <CharacterController2D>();
     if (enemyAnimator == null)
     {
         enemyAnimator = GetComponentInChildren <Animator>();
     }
     if (groundDetector == null)
     {
         groundDetector = GetComponentInChildren <DetectGround>();
     }
     if (wallDetector == null)
     {
         wallDetector = GetComponentInChildren <DetectWalls>();
     }
 }
コード例 #8
0
    private float projectileCooldown; //limit how often we can shoot

    // Use this for initialization
    void Start()
    {
        isAlive             = true;
        time_Tracker        = 0;
        timeSinceLastPress  = 0;
        m_Feet              = gameObject.GetComponentInChildren <DetectGround>();
        UI_Slider           = GameObject.FindGameObjectWithTag("UI_Slider").GetComponent <Slider>();
        m_Animator          = gameObject.GetComponent <Animator>();
        m_rb2D              = gameObject.GetComponent <Rigidbody2D>();
        SpaceAlternator     = false;
        isStunned           = false;
        isGrounded          = true;
        staminaFloat        = 60f;
        m_renderer          = GetComponent <SpriteRenderer>();
        isSliding           = false;
        slideDur            = -.5f;
        projectileCooldown  = 0;
        staminaDrainMult    = 1 / (maxSpeed / 10);
        moveSpeedMultiplier = 1; //for now
    }
コード例 #9
0
 protected override void Initialize()
 {
     base.Initialize();
     ball         = FindObjectOfType <BallBehaviour>();
     detectGround = FindObjectOfType <DetectGround>();
 }
コード例 #10
0
 private void Awake()
 {
     DG     = transform.GetChild(0).GetComponent <DetectGround>();
     rb     = GetComponent <Rigidbody2D>();
     player = GetComponent <Player>();
 }
コード例 #11
0
 protected override void Initialize()
 {
     base.Initialize();
     rb           = GetComponent <Rigidbody>();
     detectGround = GetComponent <DetectGround>();
 }