Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        animator          = GetComponent <Animator>();
        spriteRenderer    = GetComponent <SpriteRenderer>();
        characterMovement = this.transform.parent.GetComponent <CharacterMovementActuator>() as CharacterMovementActuator;
        characterContacts = this.transform.parent.GetComponent <CharacterContactSensor>() as CharacterContactSensor;
        aimingController  = this.transform.parent.FindChild("ActionControllers").GetComponent <AimingController>() as AimingController;
        corpus            = GetComponentInParent <CharacterCorpus> () as CharacterCorpus;
        hand = this.transform.parent.GetComponentInChildren <Hand> () as Hand;

        defaultColor = spriteRenderer.color;
    }
    protected virtual void Start()
    {
        if (photonView.isMine)
        {
            StartCoroutine(CheckPlayerStatus());

            aimingCtrl = GetComponent <AimingController>();

            if (myTran.GetComponentInChildren <ExtraWeaponController>() != null)
            {
                isExtra = true;
            }
        }
    }
    IEnumerator CheckPlayerStatus()
    {
        isEnabledFire = false;

        for (;;)
        {
            Transform child = myTran;
            for (;;)
            {
                Transform parent = child.parent;
                if (parent == null)
                {
                    break;
                }
                if (parent.tag == "Player" || parent.tag == "Target")
                {
                    playerTran   = parent;
                    playerStatus = parent.GetComponent <PlayerStatus>();
                    break;
                }
                child = parent;
            }

            if (playerStatus != null)
            {
                isNpc = playerStatus.IsNpc();
                AimingController aimCtrl = GetComponent <AimingController>();
                if (aimCtrl != null)
                {
                    aimCtrl.SetNpc(isNpc);
                }
                break;
            }
            yield return(null);
        }

        isEnabledFire = true;
        isReady       = true;

        //武器強化
        if (photonView.isMine && !isNpc)
        {
            int type = UserManager.GetWeaponCustomType(weaponNo);
            SetWeaponCustom(type);
        }
    }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        firingController = this.transform.parent.GetComponentInChildren <FiringController> () as FiringController;
        aimingController = this.transform.parent.GetComponentInChildren <AimingController>() as AimingController;
        movementActuator = GetComponentInParent <CharacterMovementActuator> () as CharacterMovementActuator;
        character        = GetComponentInParent <Character> () as Character;
        hand             = this.transform.parent.GetComponentInChildren <Hand> () as Hand;

        componentData = new CharacterComponentData(character);

        itemWheel = GetComponentInChildren <ItemWheel> () as ItemWheel;

        instantiatedDefault = Instantiate(defaultItemPrefab, this.transform.position, Quaternion.identity) as Item;
        instantiatedDefault.SetItemStateHeld();
        EquipItem(instantiatedDefault);
        inventory = new List <Item>();
        AddItemToInventory(instantiatedDefault);
    }
Ejemplo n.º 5
0
    public override void SetTarget(Transform target = null)
    {
        base.SetTarget(target);

        foreach (Transform child in myTran)
        {
            switch (child.tag)
            {
            case Common.CO.TAG_WEAPON_BIT:
            case Common.CO.TAG_MUZZLE:
                AimingController aimCtrl = child.GetComponent <AimingController>();
                if (aimCtrl != null)
                {
                    aimCtrl.SetTarget(target);
                }
                break;
            }
        }
    }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        controller     = GetComponent <Controller2D>();
        lightSaber     = GetComponentInChildren <LightSaber>();
        aim            = GetComponent <AimingController>();
        teleporte      = GetComponent <Teleporter>();
        playerMaterial = GetComponent <Renderer>().sharedMaterial;
        netTrans       = GetComponent <NetworkTransform>();

        if (gameObject.layer == LayerMask.NameToLayer("Player"))
        {
            lightSaber.collisionlayerMask = LayerMask.GetMask("Enemy");
        }
        else
        {
            lightSaber.collisionlayerMask = LayerMask.GetMask("Player");
        }
        lightSaber.collisionTest = isServer;
        EventSwingSaberEvent    += lightSaber.Swing;

        initialMoveSpeed = moveSpeed;
        gravity          = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        jumpVelocity     = Mathf.Abs(gravity) * timeToJumpApex;
        print("Gravity: " + gravity + " Jump Velocity: " + jumpVelocity);
        targetVelocityX = 0;

        accelerationTimeAirorne  = 0;
        accelerationTimeGrounded = 0;

        isAttacking = false;
        isDodging   = false;

        controller.horizontalRayCount = (int)(controller.horizontalRayCount * transform.localScale.x);
        controller.verticalRayCount   = (int)(controller.verticalRayCount * transform.localScale.y);
        jumpHeight      *= transform.localScale.y;
        moveSpeed       *= transform.localScale.x;
        wallJumpClimb.x *= transform.localScale.x;
        wallJumpClimb.y *= transform.localScale.y;
        wallJumpOff.x   *= transform.localScale.x;
        wallJumpOff.y   *= transform.localScale.y;
        wallLeap.x      *= transform.localScale.x;
        wallLeap.y      *= transform.localScale.y;
    }
Ejemplo n.º 7
0
 private void Start()
 {
     _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController));
     _animator         = GetComponent <IAnimator>();
 }
Ejemplo n.º 8
0
 private void Start()
 {
     _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController));
 }
 // Use this for initialization
 void Start()
 {
     movementActuator = GetComponentInParent <CharacterMovementActuator> () as CharacterMovementActuator;
     aimingController = this.transform.parent.GetComponentInChildren <AimingController> () as AimingController;
     homePosition     = this.transform.position;
 }