示例#1
0
 void Start()
 {
     this.rb2d           = GetComponent <Rigidbody2D>();
     this.cG             = gameObject.AddComponent <CheckGround>();
     this.spriteRenderer = GetComponent <SpriteRenderer>();
     this.animator       = GetComponent <Animator>();
 }
    void Awake()
    {
        //CHILDREN
        GameObject PushBoxes   = gameObject.transform.Find("PushBoxes").gameObject;
        GameObject HurtBoxes   = gameObject.transform.Find("HurtBoxes").gameObject;
        GameObject CheckGround = gameObject.transform.Find("CheckGround").gameObject;

        GameObject HurtBoxHigh = HurtBoxes.transform.Find("HurtBoxHigh").gameObject;
        GameObject HurtBoxMid  = HurtBoxes.transform.Find("HurtBoxMid").gameObject;
        GameObject HurtBoxLow  = HurtBoxes.transform.Find("HurtBoxLow").gameObject;


        //COMPONENTS
        rigidBody   = GetComponent <Rigidbody2D>();
        animator    = GetComponent <Animator>();
        pushBox     = PushBoxes.GetComponent <BoxCollider2D>();
        pushBoxHead = PushBoxes.GetComponent <CircleCollider2D>();
        hurtBoxHigh = HurtBoxHigh.GetComponent <BoxCollider2D>();
        hurtBoxMid  = HurtBoxMid.GetComponent <BoxCollider2D>();
        hurtBoxLow  = HurtBoxLow.GetComponent <BoxCollider2D>();

        //SCRIPTS
        CheckGroundScript = CheckGround.GetComponent <CheckGround>();
        CheckHitAllScript = HurtBoxes.GetComponent <CheckHitAll>();

        //VARIABLES
        life          = 9;
        moveSpeed     = 5f;
        knockBack     = 5000f;
        isGrounded    = false;
        isHurt        = false;
        isFacingRight = false;
    }
示例#3
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();

        headPos      = head.transform.localPosition;
        _checkGround = GetComponent <CheckGround>();
    }
 private void Start()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     rigidbody2D    = GetComponent <Rigidbody2D>();
     if (GetComponent <CheckGround>() != null)
     {
         checkGround = GetComponent <CheckGround>();
     }
 }
示例#5
0
 void Awake()
 {
     rgdBody     = GetComponent <Rigidbody>();
     checkGround = GetComponent <CheckGround>();
     jumping     = false;
     stuned      = false;
     SetEquipmentWeight();
     actualSpeed = speed;
 }
    void HandleInput()
    {
        if (Input.GetAxis("Fire2") > 0)
        {
            Vector3 pos = SelectPositon(Input.mousePosition);
            // instantiate event?

            Order(pos);

            unitSelector.transform.position = pos;
        }
        if (Input.GetAxis("Fire1") > 0)
        {
            //Debug.Log("selecting");
            CreateUnitSelection(Input.mousePosition);

            if (buildingAction == true)
            {
                //Place building
                PlaceBuilding placeBuilding = mineBuilding.gameObject.GetComponent <PlaceBuilding>();
                CheckGround   checkGround   = mineBuilding.gameObject.GetComponent <CheckGround>();
                //Check if building can be placed
                if (checkGround.CheckSocket() == true && checkGround.CheckType() != BlockType.Regular)
                {
                    placeBuilding.placingBuilding = false;
                    buildingAction = false;
                    checkGround.SetSocket(false);
                }
            }
        }
        else
        {
            // mouse was let go, reset
            if (selectionStarted)
            {
                CreateSelection();
            }
            selectionStarted = false;
            // CollectUnits(); store units in list?
        }

        if (Input.GetKeyUp("b"))
        {
            //If no building action is in progress, enable placing mode
            if (buildingAction == false)
            {
                GameObject buildings = GameObject.Find("Buildings");
                mineBuilding   = Instantiate(minePrefab.transform, buildings.transform);
                buildingAction = true;
            }
        }
    }
示例#7
0
    private void Start()
    {
        _checkGround = GetComponent <CheckGround>();

        // ジャンプ入力
        this.UpdateAsObservable()
        .Select(_ => _jumpFlg == true)
        .Subscribe(onJumpButtonSubject);

        // 移動入力
        this.UpdateAsObservable()
        .Select(_ => _advanceFlg == true)
        .Subscribe(x =>
        {
            isMovingRP.SetValueAndForceNotify(x);
        });
    }
示例#8
0
    void Start()
    {
        body = GetComponent <Rigidbody2D>();

        if (body)
        {
            body.freezeRotation = true;
        }

        gun      = this.transform.Find("Gun").gameObject;
        gunStuff = gun.GetComponent <BasicGunProperties>();

        checkGround = jumpTrigger.GetComponent <CheckGround>();

        currentState = grounded;

        speed = defaultSpeed;

        runAnim = breed.GetComponent <Animator>();
    }
示例#9
0
 void Start()
 {
     anim = GetComponent <Animator>();
     cG   = gameObject.GetComponent <CheckGround>();
 }
示例#10
0
 void Start()
 {
     cG    = GameObject.FindGameObjectWithTag("Player").GetComponent <CheckGround>();
     Repel = GameObject.FindGameObjectWithTag("Respawn");
     Quad  = GameObject.FindGameObjectWithTag("Player");
 }
示例#11
0
 // Use this for initialization
 public override void Start()
 {
     base.Start();
     fric        = GetComponent <ApplyFriction>();
     checkGround = GetComponent <CheckGround>();
 }
示例#12
0
    public bool yable    = true;  //y方向移动是否自主



    // Start is called before the first frame update
    void Start()
    {
        ri          = gameObject.GetComponent <Rigidbody2D>();
        checkground = gameObject.GetComponentInChildren <CheckGround>();
    }
示例#13
0
    public override void Start()
    {
        base.Start();

        checkGround = this.GetComponent <CheckGround>();
    }
示例#14
0
 private void Start()
 {
     stateManager = GetComponent <MarioStateManager>();
     checkGround  = GetComponent <CheckGround>();
 }
示例#15
0
 void Start()
 {
     anim = GetComponent <Animator>();
     cG   = GameObject.FindGameObjectWithTag("Player").GetComponent <CheckGround>();
 }
示例#16
0
 private void Awake()
 {
     pc = GetComponent <PlayerController>();
     cg = GetComponentInChildren <CheckGround>();
 }
 // Use this for initialization
 void Start()
 {
     cg        = monster.GetComponent <CheckGround> ();
     jumpForce = monster.GetComponent <Monster> ().jumpForce - 5;
 }
示例#18
0
 // Start is called before the first frame update
 private void Awake()
 {
     rigidbody         = GetComponent <Rigidbody2D>();
     marioStateManager = GetComponent <MarioStateManager>();
     checkGround       = GetComponent <CheckGround>();
 }