示例#1
0
    private void Start()
    {
        _joystick            = FindObjectOfType <DynamicJoystick>();
        _controller          = GetComponent <CharacterController>();
        _animationController = new GangAnimationController(this);
        _headTrigger         = GetComponentInChildren <GangHeadTrigger>();

        _activeMembers = new List <Member>();

        if (head == null)
        {
            head = transform.GetChild(0);
        }

        _baseRadius       = transform.lossyScale.x / 2f;
        _radiusMultiplier = _baseRadius / 2f;

        //set new members
        foreach (var member in startingMembers)
        {
            AddMember(member);
        }

        _downRayLayer = 1 << LayerMask.NameToLayer("Props");
        // This would cast rays only against colliders in layer Props.
        // But instead we want to collide against everything except layer props. The ~ operator does this, it inverts a bitmask.
        _downRayLayer = ~_downRayLayer;

        _headTrigger.interactBarrier  += InteractBarrier;
        _headTrigger.interactPushable += InteractPushable;
    }
示例#2
0
    //required coz we don't control the spawning of networked objects in the scene.
    public void Start()
    {
        PlayerManager.Instance.gunner = this;
        transform.SetParent(PlayerManager.Instance.pilot.transform);
        gunBase           = transform.Find("Base"); //Base/ - for new prefab
        barrel            = gunBase.Find("Barrel");
        muzzle            = barrel.Find("Muzzle");
        CharStats         = new CharacterStats();
        previousGyroEuler = DeviceRotation.Get().eulerAngles;
        EndScreen         = GameObject.Find("EndScreen");
        GunnerCanvas      = GameObject.Find("GunnerCanvas");

        if (GunnerCanvas)
        {
            DynamicJoystick = GunnerCanvas.transform.Find("Dynamic Joystick").GetComponent <DynamicJoystick>();
            shootButton     = GunnerCanvas.transform.Find("Button").GetComponent <Button>();
            healthbar       = GunnerCanvas.transform.Find("DoubleBar").Find("lifeBar").GetComponent <Image>();
            shieldbar       = GunnerCanvas.transform.Find("DoubleBar").Find("shieldBar").GetComponent <Image>();

            shootButton.onClick.AddListener(onShootButton);
        }


        screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0);
        mainCamera   = Camera.main;
    }
示例#3
0
 private void Start()
 {
     GMS      = GameObject.Find("GameManager").GetComponent <GameManagerScript>();
     joystick = GameObject.Find("Canvas/Dynamic Joystick").GetComponent <DynamicJoystick>();
     rb       = GetComponent <Rigidbody>();
     anim     = GetComponent <Animator>();
 }
示例#4
0
 public void Initialize()
 {
     player      = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviour>();
     ui          = GameObject.FindGameObjectWithTag("UI").GetComponent <UI_Manager>();
     joystick    = GameObject.FindGameObjectWithTag("DynamicJoystick").GetComponent <DynamicJoystick>();
     gameManager = GetComponent <GameManager>();
 }
示例#5
0
 void Awake()
 {
     _DynamicJoystick = FindObjectOfType <DynamicJoystick>();
     _rigibody        = GetComponent <Rigidbody2D>();
     _animator        = GetComponent <Animator>();
     _initialPush     = false;
     _positionSpawn   = spawn.transform.position;
     Coins            = 0;
     checkScore();
     checkSound();
 }
示例#6
0
    public void Initialize()
    {
        PilotCanvas = GameObject.Find("PilotCanvas");
        if (PilotCanvas)
        {
            DynamicJoystick  = PilotCanvas.transform.Find("Directions").GetComponent <DynamicJoystick>();
            AltitudeJoystick = PilotCanvas.transform.Find("Altitude").GetComponent <DynamicJoystick>();
            healthbar        = PilotCanvas.transform.Find("DoubleBar/lifeBar").GetComponent <Image>();
            shieldbar        = PilotCanvas.transform.Find("DoubleBar/shieldBar").GetComponent <Image>();
        }

        CharStats      = new CharacterStats();
        maxHealth      = CharStats.health;
        maxShield      = CharStats.shield;
        shieldMat      = shield.GetComponent <Renderer>().material;
        ShieldCooldown = 5;
    }
示例#7
0
    private void Awake()
    {
        gm            = FindObjectOfType <GameMan>();
        ai            = GetComponent <SteeringBehavior>();
        model         = gameObject.transform.Find("Cube").gameObject;
        rb            = GetComponent <Rigidbody>();
        pi            = new PlayerInput();
        mat           = model.GetComponent <MeshRenderer>().material;
        wakeParticle  = transform.Find("WakeParticle").GetComponent <ParticleSystem>();
        deathParticle = transform.Find("DeathParticle").GetComponent <ParticleSystem>();
        indicator     = transform.Find("Indicator").gameObject;
        movStk        = gm.movStk;
        shtStk        = gm.shtStk;

        ai.target   = gm.PlayerAgent;
        position    = rb.position;
        orientation = transform.eulerAngles.y;

        if (isPlayer)
        {
            connected = true;
        }
    }
示例#8
0
    void Start()
    {
        //currentHealth = maxHealth;
        //healthbar.SetMaxHealth(maxHealth);

        //Set variables to player1 or player2
        if (gameObject.tag == "Playa")
        {
            isPlayer1         = true;
            isTagged          = false;
            getAxisHorizontal = "Horizontal";
            getAxisVertical   = "Vertical";

            getWallAxisHor  = "HorizontalWall";
            getWallAxisVert = "VerticalWall";

            //for movement
            joystick = GameObject.FindWithTag("Joystick").GetComponent <DynamicJoystick>();
            //for wall spawn positioning
            wallJoystick = GameObject.FindWithTag("wallJoystick").GetComponent <FixedJoystick>();
            //listener for
            //GameObject.FindWithTag("wallJoystick").GetComponent<Button>().onClick.AddListener(DeployWall);

            GameObject.FindWithTag("Joybutton").GetComponent <Button>().onClick.AddListener(DeployBomb);
            //GameObject.FindWithTag("JoybuttonWall").GetComponent<Button>().onClick.AddListener(DeployWall);
            carryFlag         = GameObject.FindWithTag("Carry Flag");
            otherPlayerScript = GameObject.FindWithTag("Player2").GetComponent <PlayerController1>();
        }
        else if (gameObject.tag == "Player2")
        {
            isPlayer1         = false;
            getAxisHorizontal = "Horizontal2";
            getAxisVertical   = "Vertical2";

            getWallAxisHor  = "HorizontalWall2";
            getWallAxisVert = "VerticalWall2";

            joystick     = GameObject.FindWithTag("Joystick2").GetComponent <DynamicJoystick>();
            wallJoystick = GameObject.FindWithTag("wallJoystick2").GetComponent <FixedJoystick>();
            //GameObject.FindWithTag("wallJoystick2").GetComponent<Button>().onClick.AddListener(DeployWall);

            GameObject.FindWithTag("Joybutton2").GetComponent <Button>().onClick.AddListener(DeployBomb);
            //GameObject.FindWithTag("JoybuttonWall2").GetComponent<Button>().onClick.AddListener(DeployWall);
            carryFlag         = GameObject.FindWithTag("Carry Flag 2");
            otherPlayerScript = GameObject.FindWithTag("Playa").GetComponent <PlayerController1>();
        }

        //warningText = warningTextBox.GetComponent<Text>();

        carryFlag.SetActive(false);
        isCarryingFlag = false;
        flagIsDropped  = false;

        rb = GetComponent <Rigidbody>();

        wallCount = 10;
        bombCount = 6;

        //SetWallCountText();
        wallCountText.text = "Walls: " + wallCount.ToString();
        SetBombCountText();

        winningScreen.gameObject.SetActive(false);
        winnerText.text = "";

        m_Gyro         = Input.gyro;
        m_Gyro.enabled = true;
    }
示例#9
0
 public MobileInputController(Player player)
 {
     player.Input     = this;
     _dynamicJoystick = Object.FindObjectOfType <DynamicJoystick>();
 }
示例#10
0
 // Start is called before the first frame update
 void Start()
 {
     dj = GetComponent <DynamicJoystick>();
 }
示例#11
0
 private void Awake()
 {
     joystick        = FindObjectOfType <DynamicJoystick>();
     dozerController = GetComponent <DozerController1>();
 }
示例#12
0
 private void Start()
 {
     joystick = FindObjectOfType <DynamicJoystick>();
 }
示例#13
0
 protected override void Awake()
 {
     base.Awake();
     dj         = GetComponentInChildren <DynamicJoystick>();
     fadeImages = GetComponentsInChildren <ImageFade>();
 }