コード例 #1
0
    //Intitialization

    //Called at the start of the program
    protected void start()
    {
        m_CharacterController = GetComponent <CharacterController> ();
        //m_Anim = gameObject.GetComponentInChildren<Animation>();

        m_AnimatorController = gameObject.GetComponentInChildren <AnimatorPlayers>();

        m_SFX = SFXManager.Instance;

        GetComponentInChildren <AnimationCallBackManager>().registerCallBack(this);

        m_AcceptInputFrom = gameObject.GetComponent <AcceptInputFrom> ();

        Physics.IgnoreLayerCollision(LayerMask.NameToLayer(Constants.PLAYER_STRING),
                                     (LayerMask.NameToLayer(Constants.PLAYER_STRING)));

        //Moving platform collision

        //Players ignores moving platform collider inside each other
        Physics.IgnoreLayerCollision(LayerMask.NameToLayer(Constants.PLAYER_STRING),
                                     LayerMask.NameToLayer(Constants.COLLIDE_WITH_MOVING_PLATFORM_LAYER_STRING));

        //getting the mask of the player
        m_LayerMask = LayerMask.GetMask(Constants.LAUNCHER_STRING);
        //setting our layermask to the inverse of players
        m_LayerMask = ~m_LayerMask;
    }
コード例 #2
0
    protected AcceptInputFrom m_ReadInput;      //To get the input

    protected void start()
    {
        m_Animator = GetComponentInParent <AnimatorPlayers> ();
        m_Movement = GetComponentInParent <BaseMovementAbility> ();
        //m_ReadInput = GetComponentInParent<AcceptInputFrom>();
        m_ReadInput = transform.parent.GetComponent <AcceptInputFrom> ();

        m_AOEProjectileAngle = 360 / m_NumberOfAOEProjectiles;

        GetComponent <AnimationCallBackManager> ().registerCallBack(this);

        //Setting up trail renderers.
        m_TrailRenderers = GetComponentsInChildren <TrailRenderer>();

        m_TrailRenderersActive      = new bool[m_TrailRenderers.Length];
        m_TrailRenderersTimeAlive   = new float[m_TrailRenderers.Length];
        m_TrailRenderersCurrentTime = new float[m_TrailRenderers.Length];

        for (int i = 0; i < m_TrailRenderers.Length; i++)
        {
            m_TrailRenderersActive[i]      = false;
            m_TrailRenderersTimeAlive[i]   = m_TrailRenderers[i].time;
            m_TrailRenderersCurrentTime[i] = 0;
        }

        m_ChargingEffectMat = m_ChargingEffectObject.renderer.material;

        m_SFX = SFXManager.Instance;
    }
コード例 #3
0
    // Use this for initialization
    protected override void Start()
    {   //find the camera on this gameobject
        m_Camera = gameObject.GetComponent <Camera>();

        //===================================================================
        //move the shutter to be slightly in front of the near clipping plane
        ShutterRotationPoint.transform.forward = transform.forward;

        ShutterRotationPoint.transform.position = m_Camera.transform.position + (m_Camera.transform.forward * (m_Camera.nearClipPlane + 0.1f))
                                                  - transform.up + (transform.right * SHUTTER_OFFSET);
        base.Start();

        m_IgnoreLayer        = m_IgnoreCounter++;
        m_Camera.cullingMask = LayerMask.GetMask(CAMERA_IGNORE_LAYERS[m_IgnoreLayer]) | m_Camera.cullingMask;

        setShutterLayer(CAMERA_IGNORE_LAYERS [0]);

        SetLayerMask();

        //===================================================================
        //find the player the camera is on
        //then find out if theyre player one or two
        //adjust the screen to be on the correct players side
        Characters currentCharacter;

        switch (transform.parent.name)
        {
        case Constants.ALEX_STRING:
            currentCharacter = Characters.Alex;
            break;

        case Constants.DEREK_STRING:
            currentCharacter = Characters.Derek;
            break;

        case Constants.ZOE_STRING:
            currentCharacter = Characters.Zoe;
            break;

        default:
                                #if DEBUG || UNITY_EDITOR
            Debug.LogError("parent is named wrong");
                                #endif
            currentCharacter = Characters.Zoe;
            break;
        }

        /* horizontal split
         * if (GameData.Instance.PlayerOneCharacter == currentCharacter)
         * {
         * m_Camera.rect = new Rect(0.0f, 0.5f, 1.0f, 0.5f);
         * }
         * else
         * {
         * m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 0.5f);
         * }*/

        //vertical split
        if (GameData.Instance.PlayerOneCharacter == currentCharacter)
        {
            m_Camera.rect = new Rect(0.0f, 0.0f, 0.5f - SPLIT_AMOUNT, 1.0f);
        }
        else
        {
            m_Camera.rect = new Rect(0.5f + SPLIT_AMOUNT, 0.0f, 0.5f, 1.0f);
        }
        //==================================================================================
        //get the accept input from script on the camera game object
        m_AcceptInputFrom = gameObject.GetComponent <AcceptInputFrom>();

        //===================================================================
        //make sure that game data updates our rotation scale modifyer
        GameData.Instance.updateCameraRotationSpeeds();
    }
コード例 #4
0
ファイル: TPCamera.cs プロジェクト: ZaikMD/ImagineNation
    // Use this for initialization
    protected override void Start()
    {
        //find the camera on this gameobject
        m_Camera = gameObject.GetComponent<Camera>();

        //===================================================================
        //move the shutter to be slightly in front of the near clipping plane
        ShutterRotationPoint.transform.forward = transform.forward;

        ShutterRotationPoint.transform.position = m_Camera.transform.position + (m_Camera.transform.forward * (m_Camera.nearClipPlane + 0.1f))
                                                    - transform.up + (transform.right * SHUTTER_OFFSET);
        base.Start ();

        m_IgnoreLayer = m_IgnoreCounter++;
        m_Camera.cullingMask = LayerMask.GetMask(CAMERA_IGNORE_LAYERS[m_IgnoreLayer]) | m_Camera.cullingMask;

        setShutterLayer (CAMERA_IGNORE_LAYERS [0]);

        SetLayerMask();

        //===================================================================
        //find the player the camera is on
        //then find out if theyre player one or two
        //adjust the screen to be on the correct players side
        Characters currentCharacter;
        switch (transform.parent.name)
        {
            case Constants.ALEX_STRING:
                currentCharacter = Characters.Alex;
                break;
            case Constants.DEREK_STRING:
                currentCharacter = Characters.Derek;
                break;
            case Constants.ZOE_STRING:
                currentCharacter = Characters.Zoe;
                break;
            default:
                #if DEBUG || UNITY_EDITOR
               		Debug.LogError("parent is named wrong");
                #endif
                currentCharacter = Characters.Zoe;
                break;
        }
        /* horizontal split
        if (GameData.Instance.PlayerOneCharacter == currentCharacter)
        {
           m_Camera.rect = new Rect(0.0f, 0.5f, 1.0f, 0.5f);
        }
        else
        {
            m_Camera.rect = new Rect(0.0f, 0.0f, 1.0f, 0.5f);
        }*/

        //vertical split
        if (GameData.Instance.PlayerOneCharacter == currentCharacter)
        {
            m_Camera.rect = new Rect(0.0f, 0.0f, 0.5f - SPLIT_AMOUNT, 1.0f);
        }
        else
        {
            m_Camera.rect = new Rect(0.5f + SPLIT_AMOUNT, 0.0f, 0.5f, 1.0f);
        }
        //==================================================================================
        //get the accept input from script on the camera game object
        m_AcceptInputFrom = gameObject.GetComponent<AcceptInputFrom>();

        //===================================================================
        //make sure that game data updates our rotation scale modifyer
        GameData.Instance.updateCameraRotationSpeeds();
    }
コード例 #5
0
    //Intitialization
    //Called at the start of the program
    protected void start()
    {
        m_CharacterController = GetComponent<CharacterController> ();
        //m_Anim = gameObject.GetComponentInChildren<Animation>();

        m_AnimatorController = gameObject.GetComponentInChildren<AnimatorPlayers>();

        m_SFX = SFXManager.Instance;

        GetComponentInChildren<AnimationCallBackManager>().registerCallBack(this);

        m_AcceptInputFrom = gameObject.GetComponent<AcceptInputFrom> ();

        Physics.IgnoreLayerCollision (LayerMask.NameToLayer (Constants.PLAYER_STRING),
                                      (LayerMask.NameToLayer (Constants.PLAYER_STRING)));

        //Moving platform collision

        //Players ignores moving platform collider inside each other
        Physics.IgnoreLayerCollision (LayerMask.NameToLayer (Constants.PLAYER_STRING),
                                      LayerMask.NameToLayer (Constants.COLLIDE_WITH_MOVING_PLATFORM_LAYER_STRING));

        //getting the mask of the player
        m_LayerMask = LayerMask.GetMask (Constants.LAUNCHER_STRING);
        //setting our layermask to the inverse of players
        m_LayerMask = ~m_LayerMask;
    }
コード例 #6
0
ファイル: BaseWeapon.cs プロジェクト: ZaikMD/ImagineNation
    protected void start()
    {
        m_Animator = GetComponentInParent<AnimatorPlayers> ();
        m_Movement = GetComponentInParent<BaseMovementAbility> ();
        //m_ReadInput = GetComponentInParent<AcceptInputFrom>();
        m_ReadInput = transform.parent.GetComponent<AcceptInputFrom> ();

        m_AOEProjectileAngle = 360 / m_NumberOfAOEProjectiles;

        GetComponent<AnimationCallBackManager> ().registerCallBack (this);

        //Setting up trail renderers.
        m_TrailRenderers = GetComponentsInChildren<TrailRenderer>();

        m_TrailRenderersActive = new bool[m_TrailRenderers.Length];
        m_TrailRenderersTimeAlive = new float[m_TrailRenderers.Length];
        m_TrailRenderersCurrentTime = new float[m_TrailRenderers.Length];

        for(int i = 0; i < m_TrailRenderers.Length; i++)
        {
            m_TrailRenderersActive[i] = false;
            m_TrailRenderersTimeAlive[i] = m_TrailRenderers[i].time;
            m_TrailRenderersCurrentTime[i] = 0;
        }

        m_ChargingEffectMat = m_ChargingEffectObject.renderer.material;

        m_SFX = SFXManager.Instance;
    }